GrapeCity MultiRow Windows Forms Documentation
SortMode Property
Example 


Gets or sets which sorting mode is used.
Syntax
<SRCategoryAttribute("Behavior")>
<DefaultValueAttribute()>
<SRDescriptionAttribute("Indicates which sort operation is performed.")>
Public Property SortMode As SortMode
Dim instance As ColumnHeaderCell
Dim value As SortMode
 
instance.SortMode = value
 
value = instance.SortMode
[SRCategory("Behavior")]
[DefaultValue()]
[SRDescription("Indicates which sort operation is performed.")]
public SortMode SortMode {get; set;}

Property Value

One of the SortMode values. The default is SortMode.NotSortable.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentExceptionThe specified value is not one of the SortMode values.
System.InvalidOperationException

The assigned value is SortMode.NotSortable and the SortGlyphDirection is not System.Windows.Forms.SortOrder.None.

-or-

The assigned value is SortMode.Automatic and the SelectionMode is not MultiRowSelectionMode.None.

Remarks

You should set this property with SortCellIndex or SortCellName.

When you set this property to SortMode.Automatic and specify the SortCellIndex or SortCellName, once you click this ColumnHeaderCell, the specified cells in the row are sorted automatically, and a sort glyph is displayed on the cell to indicate the sort order. This behavior is not allowed to be used with SelectionMode.

When the control is sorted using a column with a SortMode property value of Programmatic, you must display the sorting glyph yourself with the SortGlyphDirection property.

Example
The following code example shows how to make a column header cell perform a sort when clicking with the mouse. To run this example, create a GcMultiRow control in a form and copy the code into the Form.Load event handler.
private void Form1_Load(object sender, EventArgs e)
        {
            Template template1 = Template.CreateGridTemplate(4);

            ColumnHeaderCell columnHeaderCell = template1.ColumnHeaders[0][0] as ColumnHeaderCell;

            columnHeaderCell.SelectionMode = MultiRowSelectionMode.None;
            columnHeaderCell.SortMode = SortMode.Automatic;
            columnHeaderCell.SortCellName = "textBoxCell1";

            gcMultiRow1.Template = template1;
        }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim template1 As Template = Template.CreateGridTemplate(4)

        Dim columnHeaderCell As ColumnHeaderCell = TryCast(template1.ColumnHeaders(0)(0), ColumnHeaderCell)

        columnHeaderCell.SelectionMode = MultiRowSelectionMode.None
        columnHeaderCell.SortMode = SortMode.Automatic
        columnHeaderCell.SortCellName = "textBoxCell1"

        gcMultiRow1.Template = template1
    End Sub
Requirements

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

See Also

Reference

ColumnHeaderCell Class
ColumnHeaderCell Members
SortCellIndex Property
SortCellName Property
SortGlyphDirection Property

 

 


Copyright © GrapeCity, inc. All rights reserved.