PowerTools MultiRow for Windows Forms 8.0J
Items プロパティ (HeaderDropDownList)
使用例 

HeaderDropDownList内の項目のコレクションを取得します。
構文
Public ReadOnly Property Items As DropDownItemCollection
public DropDownItemCollection Items {get;}

プロパティ値

ドロップダウンリストに含まれる項目のコレクションを表すDropDownItemCollection
使用例
次のサンプルコードは、このプロパティを使用して、並べ替えまたはフィルタを実行するためのドロップダウンリストを列ヘッダセルに作成する方法を示します。このサンプルコードは、ColumnHeaderCell.DropDownListプロパティに示されている詳細なコード例の一部を抜粋したものです。
void setSecondColumnDropDownListButton_Click(object sender, EventArgs e)
{
    // Create a header drop down list without default down down items.
    HeaderDropDownList headerDropDownList = new HeaderDropDownList();

    // If do not indicate which cell to be filtered, the cell which has same index with column header cell in row section will be filtered.
    headerDropDownList.CellName = "textBoxCell2";

    DropDownItemCollection dropDownItemCollection = headerDropDownList.Items;
    // Initialize drop down items manually.
    // Add sort item.
    dropDownItemCollection.Add(new DropDownSortItem(SortOrder.Ascending));
    dropDownItemCollection.Add(new DropDownSortItem(SortOrder.Descending));
    
    // Add a separator line.
    dropDownItemCollection.Add(new DropDownSeparatorItem());

    // Add show all, black and none black items.
    dropDownItemCollection.Add(new DropDownShowAllFilterItem());
    dropDownItemCollection.Add(new DropDownBlanksFilterItem());
    dropDownItemCollection.Add(new DropDownNonBlanksFilterItem());

    // Add auto filter items.
    dropDownItemCollection.Add(new DropDownAutoFilterItem());

    // Get second column header cell.
    ColumnHeaderCell columnHeaderCell = this.gcMultiRow1.ColumnHeaders[0][1] as ColumnHeaderCell;
    columnHeaderCell.DropDownList = headerDropDownList;
}
Private Sub setSecondColumnDropDownListButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setSecondColumnDropDownListButton.Click
    ' Create a header drop down list without default down down items.
    Dim headerDropDownList As New HeaderDropDownList()

    ' If do not indicate which cell to be filtered, the cell which has same index with column header cell in row section will be filtered.
    headerDropDownList.CellName = "textBoxCell2"

    Dim dropDownItemCollection As DropDownItemCollection = headerDropDownList.Items
    ' Initialize drop down items manually.
    ' Add sort item.
    dropDownItemCollection.Add(New DropDownSortItem(SortOrder.Ascending))
    dropDownItemCollection.Add(New DropDownSortItem(SortOrder.Descending))

    ' Add a separator line.
    dropDownItemCollection.Add(New DropDownSeparatorItem())

    ' Add show all, black and none black items.
    dropDownItemCollection.Add(New DropDownShowAllFilterItem())
    dropDownItemCollection.Add(New DropDownBlanksFilterItem())
    dropDownItemCollection.Add(New DropDownNonBlanksFilterItem())

    ' Add auto filter items.
    dropDownItemCollection.Add(New DropDownAutoFilterItem())

    ' Get second column header cell.
    Dim columnHeaderCell As ColumnHeaderCell = TryCast(Me.gcMultiRow1.ColumnHeaders(0)(1), ColumnHeaderCell)
    columnHeaderCell.DropDownList = headerDropDownList
End Sub
参照

HeaderDropDownList クラス
HeaderDropDownList メンバ

 

 


© 2008-2015 GrapeCity inc. All rights reserved.