GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : SortCompare Event |
<SRDescriptionAttribute("Occurs when the GcMultiRow control compares two cell values to perform a sort operation.")> <SRCategoryAttribute("Data")> Public Event SortCompare As EventHandler(Of SortCompareEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of SortCompareEventArgs) AddHandler instance.SortCompare, handler
[SRDescription("Occurs when the GcMultiRow control compares two cell values to perform a sort operation.")] [SRCategory("Data")] public event EventHandler<SortCompareEventArgs> SortCompare
The event handler receives an argument of type SortCompareEventArgs containing data related to this event. The following SortCompareEventArgs properties provide information specific to this event.
Property | Description |
---|---|
CellIndex | Gets the cell index in its parent Section. |
CellValue1 | Gets the value of the first cell to compare. |
CellValue2 | Gets the value of the second cell to compare. |
Handled | (Inherited from System.ComponentModel.HandledEventArgs) |
RowIndex1 | Gets the row index of the first cell to compare. |
RowIndex2 | Gets the row index that contains the second cell to compare. |
SortResult | Gets or sets the sort result. |
This event occurs only when the DataSource property is not set and the VirtualMode property value is false.
This event compares pairs of cells in two different rows being sorted. It occurs only when you use the ColumnHeaderCell to sort, or when you call the Sort(int) overloaded methods. When this event occurs for a ColumnHeaderCell.SortMode property value of SortMode.Programmatic, you must display the sorting glyph yourself with the ColumnHeaderCell.SortGlyphDirection property.
void gcMultiRow1_SortCompare(object sender, SortCompareEventArgs e) { // Customize sort logic by using SortCompare event. // Sort by backcolor. Color color1 = gcMultiRow1[e.RowIndex1,e.CellIndex].InheritedStyle.BackColor; Color color2 = gcMultiRow1[e.RowIndex2, e.CellIndex].InheritedStyle.BackColor; e.SortResult = color1.ToArgb().CompareTo(color2.ToArgb()); e.Handled = true; }
Private Sub gcMultiRow1_SortCompare(ByVal sender As Object, ByVal e As SortCompareEventArgs) Handles gcMultiRow1.SortCompare ' Customize sort logic by using SortCompare event. ' Sort by backcolor. Dim color1 As Color = gcMultiRow1(e.RowIndex1, e.CellIndex).InheritedStyle.BackColor Dim color2 As Color = gcMultiRow1(e.RowIndex2, e.CellIndex).InheritedStyle.BackColor e.SortResult = color1.ToArgb().CompareTo(color2.ToArgb()) e.Handled = True End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2