Spread Silverlight Documentation
Name Property (StyleInfo)
Example 


Gets or sets the name of the style.
Syntax
'Declaration
 
<System.ComponentModel.DefaultValueAttribute()>
Public Overridable Property Name As System.String
'Usage
 
Dim instance As StyleInfo
Dim value As System.String
 
instance.Name = value
 
value = instance.Name
[System.ComponentModel.DefaultValue()]
public virtual System.string Name {get; set;}

Property Value

The name of the style.
Example
This example creates a named style.
gcSpreadSheet1.Sheets[0].NamedStyles.Add(new GrapeCity.Windows.SpreadSheet.Data.StyleInfo() { Background = new SolidColorBrush(Colors.Red), Name = "aaa", VerticalAlignment = GrapeCity.Windows.SpreadSheet.Data.CellVerticalAlignment.Center } );
var style = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
gcSpreadSheet1.Sheets[0].Cells[0, 0].StyleName = "aaa";
gcSpreadSheet1.Sheets[0].Rows[7].StyleName = "aaa";
style.Background = new SolidColorBrush(Colors.Blue);
style.BorderLeft = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
style.BorderTop = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
style.BorderRight = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
style.BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);    
//Style applied to a rule
var rule = GrapeCity.Windows.SpreadSheet.Data.AverageRule.Create(GrapeCity.Windows.SpreadSheet.Data.AverageConditionType.Above, style);
rule.Ranges = new GrapeCity.Windows.SpreadSheet.Data.CellRange[] { new GrapeCity.Windows.SpreadSheet.Data.CellRange(1, 0, 5, 1) };
gcSpreadSheet1.Sheets[0].ConditionalFormats.AddRule(rule);
gcSpreadSheet1.Sheets[0].Cells[2, 0].Value = 25;
gcSpreadSheet1.Sheets[0].Cells[1, 0].Value = 2;
gcSpreadSheet1.Invalidate(); 

private void button1_Click(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.Sheets[0].Cells[0, 0].ResetStyleName();
            gcSpreadSheet1.Invalidate();
        }
GcSpreadSheet1.Sheets(0).NamedStyles.Add(New GrapeCity.Windows.SpreadSheet.Data.StyleInfo() With {.Background = New SolidColorBrush(Colors.Red), .Name = "aaa", .VerticalAlignment = GrapeCity.Windows.SpreadSheet.Data.CellVerticalAlignment.Center})
GcSpreadSheet1.Sheets(0).Cells(0, 0).StyleName = "aaa"
GcSpreadSheet1.Sheets(0).Rows(7).StyleName = "aaa"
Dim style As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
style.Background = New SolidColorBrush(Colors.Blue)
style.BorderLeft = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
style.BorderTop = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
style.BorderRight = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
style.BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
'Style applied to a rule
Dim rule = GrapeCity.Windows.SpreadSheet.Data.AverageRule.Create(GrapeCity.Windows.SpreadSheet.Data.AverageConditionType.Above, Style)
rule.Ranges = New GrapeCity.Windows.SpreadSheet.Data.CellRange() {New GrapeCity.Windows.SpreadSheet.Data.CellRange(1, 0, 5, 1)}
GcSpreadSheet1.Sheets(0).ConditionalFormats.AddRule(rule)
GcSpreadSheet1.Sheets(0).Cells(2, 0).Value = 25
GcSpreadSheet1.Sheets(0).Cells(1, 0).Value = 2
GcSpreadSheet1.Invalidate()

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
GcSpreadSheet1.Sheets(0).Cells(0, 0).ResetStyleName()
GcSpreadSheet1.Invalidate()
End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

StyleInfo Class
StyleInfo Members

 

 


Copyright © GrapeCity, inc. All rights reserved.