GrapeCity MultiRow Windows Forms Documentation
SortGlyphDirection Property
Example 


Gets or sets the sort glyph direction.
Syntax
<DefaultValueAttribute()>
<SRCategoryAttribute("Behavior")>
<SRDescriptionAttribute("Indicates the current direction of the sort glyph.")>
<RefreshPropertiesAttribute(RefreshProperties.All)>
Public Property SortGlyphDirection As SortOrder
Dim instance As ColumnHeaderCell
Dim value As SortOrder
 
instance.SortGlyphDirection = value
 
value = instance.SortGlyphDirection
[DefaultValue()]
[SRCategory("Behavior")]
[SRDescription("Indicates the current direction of the sort glyph.")]
[RefreshProperties(RefreshProperties.All)]
public SortOrder SortGlyphDirection {get; set;}

Property Value

One of the System.Windows.Forms.SortOrder values. The default is System.Windows.Forms.SortOrder.None.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentExceptionThe specified value is not one of the System.Windows.Forms.SortOrder values.
Remarks
This property is set automatically for ColumnHeaderCell with the SortMode property set to Automatic. You must set this property yourself when sorting by ColumnHeaderCell with the SortMode property set to Programmatic.
Example
The following code example shows how to customize sort behavior when the user clicks the column header cell. To run this example, create a GcMultiRow control in a form with a template. The template should contain at least one cell in the row and a column header cell in the column header section. The column header cell's SelectionMode should be None, and SortMode should be Programmatic.
void gcMultiRow1_CellClick(object sender, CellEventArgs e)
        {
            if (e.CellName == "ColumnHeaderCell1" && e.Scope == CellScope.ColumnHeader)
            {
                ColumnHeaderCell columnheaderCell = gcMultiRow1.ColumnHeaders[0][e.CellName] as 
ColumnHeaderCell;
                
                BindingSource bindingSource = this.gcMultiRow1.DataSource as BindingSource;

                if (columnheaderCell.SortGlyphDirection == SortOrder.None || columnheaderCell.SortGlyphDirection 
== SortOrder.Descending)
                {
                    bindingSource.Sort = "scores ASC";
                }
                else
                {
                    bindingSource.Sort = "scores DESC";
                }
            }
        }
Private Sub gcMultiRow1_CellClick(ByVal sender As Object, ByVal e As CellEventArgs) Handles 
gcMultiRow1.CellClick
        If e.CellName = "ColumnHeaderCell1" AndAlso e.Scope = CellScope.ColumnHeader Then
            Dim columnheaderCell As ColumnHeaderCell = TryCast(gcMultiRow1.ColumnHeaders(0)(e.CellName), 
ColumnHeaderCell)

            Dim bindingSource As BindingSource = TryCast(Me.gcMultiRow1.DataSource, BindingSource)

            If columnheaderCell.SortGlyphDirection = SortOrder.None OrElse columnheaderCell.SortGlyphDirection 
= SortOrder.Descending Then
                bindingSource.Sort = "scores ASC"
            Else
                bindingSource.Sort = "scores DESC"
            End If
        End If
    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
SortMode Property

 

 


Copyright © GrapeCity, inc. All rights reserved.