Spread WPF Documentation
Create Method (Top10Rule)
Example 


GrapeCity.Windows.SpreadSheet.Data Namespace > Top10Rule Class : Create Method
The Top10ConditionType top 10 condition type.
>The number of top or bottom items
The style that is set by the rule.
Creates a top 10 rule with specified parameters.
Syntax
'Declaration
 
Public Shared Function Create( _
   ByVal op As Top10ConditionType, _
   ByVal rank As System.Integer, _
   ByVal style As StyleInfo _
) As Top10Rule
'Usage
 
Dim op As Top10ConditionType
Dim rank As System.Integer
Dim style As StyleInfo
Dim value As Top10Rule
 
value = Top10Rule.Create(op, rank, style)
public static Top10Rule Create( 
   Top10ConditionType op,
   System.int rank,
   StyleInfo style
)

Parameters

op
The Top10ConditionType top 10 condition type.
rank
>The number of top or bottom items
style
The style that is set by the rule.

Return Value

The new top 10 rule.
Example
This example checks for the top 2 values in the range.
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)
Dim style1 As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
style1.Background = New SolidColorBrush(Colors.Green)
Dim style2 As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
style2.Background = New SolidColorBrush(Colors.Yellow)

Dim rule = GrapeCity.Windows.SpreadSheet.Data.Top10Rule.Create(GrapeCity.Windows.SpreadSheet.Data.Top10ConditionType.Top, 2, style);   
rule.Ranges = New GrapeCity.Windows.SpreadSheet.Data.CellRange() {New GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 10, 1)}
GcSpreadSheet1.Sheets(0).ConditionalFormats.AddRule(rule)

GcSpreadSheet1.Sheets(0).SetValue(0, 0, 1)
GcSpreadSheet1.Sheets(0).SetValue(1, 0, 50)
GcSpreadSheet1.Sheets(0).SetValue(2, 0, 11)
GcSpreadSheet1.Sheets(0).SetValue(3, 0, 5)
GcSpreadSheet1.Invalidate()
var style = 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);
var style1 = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
style1.Background = new SolidColorBrush(Colors.Green);
var style2 = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
style2.Background = new SolidColorBrush(Colors.Yellow);

var rule = GrapeCity.Windows.SpreadSheet.Data.Top10Rule.Create(GrapeCity.Windows.SpreadSheet.Data.Top10ConditionType.Top, 2, style);
rule.Ranges = new GrapeCity.Windows.SpreadSheet.Data.CellRange[] { new GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 10, 1) };
gcSpreadSheet1.Sheets[0].ConditionalFormats.AddRule(rule);

gcSpreadSheet1.Sheets[0].SetValue(0, 0, 1);
gcSpreadSheet1.Sheets[0].SetValue(1, 0, 50);
gcSpreadSheet1.Sheets[0].SetValue(2, 0, 11);
gcSpreadSheet1.Sheets[0].SetValue(3, 0, 5);
gcSpreadSheet1.Invalidate();
See Also

Reference

Top10Rule Class
Top10Rule Members