FlexGrid displays various icons during its operations such as sorting, filtering etc. These icons can be changed using various icon templates provided in the FlexGrid control. These icon templates can be accessed through following properties.
Properties | Description |
---|---|
SortAscendingIconTemplate | Allows you to set the template of sort icon for sorting values in ascending order. |
SortDescendingIconTemplate | Allows you to set the template of sort icon for sorting values in descending order. |
ActiveFilterIconTemplate | Allows you to set the template which is used to present the active filter icon when the column is not filtered. |
InactiveFilterIconTemplate | Allows you to set the template which is used to present the inactive filter icon when the column is filtered. |
ExpandedAboveIconTemplate | Allows you to set the template for icon when the item group/detail is expanded above. |
ExpandedBelowIconTemplate | Allows you to set the template for icon when the item group/detail is expanded below. |
CollapsedIconTemplate | Allows you to set the template for group icon when the item group/detail is collapsed. |
NewRowIconTemplate | Allows you to set the template of new row icon displayed in the header of a new row. |
You can change the icons set by these templates either to the built-in icons provided by the FlexGrid or to your own custom image, geometric figures, font etc as an icon.
The following image displays a custom image which is set as a sort icon for sorting values in descending order.
FlexGrid also allows you to change the appearance of the different icons used in the control using the C1Icon class. The C1Icon class is an abstract class that provides a series of different objects that can be used for displaying monochromatic icons which can easily be tinted and resized.
To set the built-in icons for the abovementioned templates, you can set the following properties of the C1IconTemplate class.
Icon | Image |
---|---|
Edit | |
Asterisk | |
ArrowUp | |
ArrowDown | |
ChevronUp | |
ChevronDown | |
ChevronLeft | |
ChevronRight | |
TriangleNorth | |
TriangleSouth | |
TriangleEast | |
TriangleWest | |
TriangleSouthEast | |
Star5 |
For instance, to change the default sort ascending icon to a built-in icon, for example, TriangleNorth, use the following code:
C# |
コードのコピー
|
---|---|
grid.SortAscendingIconTemplate = C1IconTemplate.TriangleNorth; |
FlexGrid also allows you to set your own custom image, font, or path as an icon through the respective classes.
Icon Type | Icon Class Name |
---|---|
Bitmap/Image | C1BitmapIcon class |
Font character | C1FontIcon class |
Path | C1PolygonIcon class (child class of C1VectorIcon class) |
For instance, to change the default sort descending icon to a custom image, use the following code:
C# |
コードのコピー
|
---|---|
BitmapImage imgDown = new BitmapImage(); imgDown.BeginInit(); imgDown.UriSource = new Uri("icons/arrow_down.png", UriKind.Relative); imgDown.EndInit(); _flexGrid.SortDescendingIconTemplate = new C1IconTemplate(() => new C1BitmapIcon() { Source = imgDown, Width = 20, Height = 20 }); |