Spread Windows Forms 9.0 Product Documentation
Defining the Order of the Items in the Filter Item List

You can customize how the drop-down list of filter items is displayed. By default, the list shows the possible filter items alphabetically and includes all the options. By changing the value of the FilterListBehavior enumeration, you change how the filter list is displayed. For example you can set the filter list to display items in order of number of occurrences in that column.

Use the AddColumn methods and specify the column filter definition. This also defines the way the filter items appear in the drop-down.

Using Code

Set the FilterListBehavior enumeration to change how the filter list is displayed.

Example

The following example illustrates setting the FilterListBehavior enumeration in code.

C#
Copy Code
FarPoint.Win.Spread.NamedStyle instyle = new FarPoint.Win.Spread.NamedStyle();
FarPoint.Win.Spread.NamedStyleim outstyle = new FarPoint.Win.Spread.NamedStyle();
instyle.BackColor = Color.Yellow;
outstyle.BackColor = Color.Aquamarine;
FarPoint.Win.Spread.FilterColumnDefinition fcd = new FarPoint.Win.Spread.FilterColumnDefinition(1, FarPoint.Win.Spread.FilterListBehavior.SortByMostOccurrences | FarPoint.Win.Spread.FilterListBehavior.Default);
FarPoint.Win.Spread.FilterColumnDefinition fcd1 = new FarPoint.Win.Spread.FilterColumnDefinition(2);
FarPoint.Win.Spread.FilterColumnDefinition fcd2 = new FarPoint.Win.Spread.FilterColumnDefinition();
FarPoint.Win.Spread.StyleRowFilter sf = new FarPoint.Win.Spread.StyleRowFilter(fpSpread1.ActiveSheet, instyle, outstyle);
sf.AddColumn(fcd);
sf.AddColumn(fcd1);
sf.AddColumn(fcd2);
fpSpread1.ActiveSheet.RowFilter = sf;
fpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.FilterGadget;
VB
Copy Code
Dim instyle As New FarPoint.Win.Spread.NamedStyle
Dim outstyle As New FarPoint.Win.Spread.NamedStyle
instyle.BackColor = Color.Yellow
outstyle.BackColor = Color.Aquamarine
Dim fcd As New FarPoint.Win.Spread.FilterColumnDefinition(1, FarPoint.Win.Spread.FilterListBehavior.SortByMostOccurrences Or FarPoint.Win.Spread.FilterListBehavior.Default)
Dim fcd1 As New FarPoint.Win.Spread.FilterColumnDefinition(2)
Dim fcd2 As New FarPoint.Win.Spread.FilterColumnDefinition
Dim sf As New FarPoint.Win.Spread.StyleRowFilter(fpSpread1.ActiveSheet, instyle, outstyle)
sf.AddColumn(fcd)
sf.AddColumn(fcd1)
sf.AddColumn(fcd2)
fpSpread1.ActiveSheet.RowFilter = sf
FpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.FilterGadget
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback