SPREAD for WPF 3.0J - GcSpreadGrid
SortDescriptions プロパティ
使用例 

GrapeCity.Windows.SpreadGrid 名前空間 > GcSpreadGrid クラス : SortDescriptions プロパティ
GcSpreadGrid の Rows のソート方法を記述する SpreadSortDescription オブジェクトのコレクションを取得します。
シンタックス
'宣言
 
Public ReadOnly Property SortDescriptions As SpreadSortDescriptionCollection
public SpreadSortDescriptionCollection SortDescriptions {get;}

プロパティ値

GcSpreadGrid の Rows のソート方法を記述する SpreadSortDescription オブジェクトのコレクション。
使用例
次のサンプルはSortDescriptionsプロパティの使用方法を説明します。
public void SortFilter()
{
gcSpreadGrid1.Columns[0].Name = "column1";

SpreadSortDescription column1SD = new SpreadSortDescription();
column1SD.ColumnIndex = 0;
column1SD.Direction = System.ComponentModel.ListSortDirection.Ascending;
column1SD.IsCaseSensitive = true;
gcSpreadGrid1.SortDescriptions.Add(column1SD);

SpreadSortDescription column2SD = new SpreadSortDescription();
column2SD.ColumnIndex = 1;
column2SD.Comparer = new MySexCompare();
gcSpreadGrid1.SortDescriptions.Add(column2SD);

gcSpreadGrid1[0, 0].Value = "日曜日";
gcSpreadGrid1[0, 1].Value = "月曜日";
gcSpreadGrid1[0, 2].Value = "火曜日";
gcSpreadGrid1[0, 0].Value = "日曜日";
gcSpreadGrid1[0, 0].Value = "木曜日";
SpreadFilterDescription column1Filter = new SpreadFilterDescription();
column1Filter.ColumnName = "column1";
column1Filter.Conditions.Add(new IncludeListCondition(new object[] { "日曜日", "木曜日" }));
gcSpreadGrid1.FilterDescriptions.Add(column1Filter);
}
private class MySexCompare : StringComparer
{
public override int Compare(string x, string y)
{
if (string.Equals(x, y, StringComparison.OrdinalIgnoreCase))
{
return string.Compare(x, y, StringComparison.Ordinal);
}
if (string.Equals(x, "man", StringComparison.OrdinalIgnoreCase))
{
return 1;
}
if (string.Equals(x, "woman", StringComparison.OrdinalIgnoreCase))
{
return -1;
}
return string.Compare(x, y, StringComparison.Ordinal);
}

public override bool Equals(string x, string y)
{
return x == y;
}

public override int GetHashCode(string obj)
{
return obj.GetHashCode();
}
}
Public Sub SortFilter()
gcSpreadGrid1.Columns(0).Name = "column1"

Dim column1SD As New SpreadSortDescription()
column1SD.ColumnIndex = 0
column1SD.Direction = System.ComponentModel.ListSortDirection.Ascending
column1SD.IsCaseSensitive = True
gcSpreadGrid1.SortDescriptions.Add(column1SD)

Dim column2SD As New SpreadSortDescription()
column2SD.ColumnIndex = 1
column2SD.Comparer = New MySexCompare()
gcSpreadGrid1.SortDescriptions.Add(column2SD)

gcSpreadGrid1(0, 0).Value = "日曜日"
gcSpreadGrid1(0, 1).Value = "月曜日"
gcSpreadGrid1(0, 2).Value = "火曜日"
gcSpreadGrid1(0, 0).Value = "日曜日"
gcSpreadGrid1(0, 0).Value = "木曜日"
Dim column1Filter As New SpreadFilterDescription()
column1Filter.ColumnName = "column1"
column1Filter.Conditions.Add(New IncludeListCondition(New Object() {"日曜日", "木曜日"}))
gcSpreadGrid1.FilterDescriptions.Add(column1Filter)
End Sub
Private Class MySexCompare
Inherits StringComparer
Public Overrides Function Compare(x As String, y As String) As Integer
If String.Equals(x, y, StringComparison.OrdinalIgnoreCase) Then
Return String.Compare(x, y, StringComparison.Ordinal)
End If
If String.Equals(x, "man", StringComparison.OrdinalIgnoreCase) Then
Return 1
End If
If String.Equals(x, "woman", StringComparison.OrdinalIgnoreCase) Then
Return -1
End If
Return String.Compare(x, y, StringComparison.Ordinal)
End Function

Public Overrides Function Equals(x As String, y As String) As Boolean
Return x = y
End Function

Public Overrides Function GetHashCode(obj As String) As Integer
Return obj.GetHashCode()
End Function
End Class
参照

GcSpreadGrid クラス
GcSpreadGrid メンバ