本頁是否能提供幫助?
您對此內容的意見反應十分重要。 請告訴我們您的想法。
其他意見反應?
剩餘 1500 個字元
匯出 (0) 列印
全部展開
Expand Minimize

DataGridHeadersVisibility Enumeration

Specifies constants that define which DataGrid header cells are displayed.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

[FlagsAttribute]
public enum DataGridHeadersVisibility
<object property="enumMemberName"/>

Member nameDescription
AllBoth column and row header cells are displayed.
ColumnOnly column header cells are displayed.
RowOnly row header cells are displayed.
NoneNo header cells are displayed.

This enumeration is used by the DataGrid.HeadersVisibility property.

The following code example demonstrates how to use the DataGridHeadersVisibility enumeration. This example is part of a larger example available in the Walkthrough: Customizing the DataGrid Control Using Properties topic.


private void cbHeaders_SelectionChanged(object sender, RoutedEventArgs e)
{
    ComboBoxItem cbi = ((ComboBox)sender).SelectedItem as ComboBoxItem;
    if (this.dataGrid1 != null)
    {
        if (cbi.Content.ToString() == "All")
            this.dataGrid1.HeadersVisibility = DataGridHeadersVisibility.All;
        else if (cbi.Content.ToString() == "Column (Default)")
            this.dataGrid1.HeadersVisibility = DataGridHeadersVisibility.Column;
        else if (cbi.Content.ToString() == "Row")
            this.dataGrid1.HeadersVisibility = DataGridHeadersVisibility.Row;
        else
            this.dataGrid1.HeadersVisibility = DataGridHeadersVisibility.None;
    }

}


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

社群新增項目

新增
顯示:
© 2015 Microsoft