Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridGridLinesVisibility Enumeration

Specifies constants that define which grid lines separating DataGrid inner cells are shown.

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)

public enum DataGridGridLinesVisibility
<object property="enumMemberName"/>

Member nameDescription
NoneNo grid lines are shown.
HorizontalOnly horizontal grid lines, which separate rows, are shown.
VerticalOnly vertical grid lines, which separate columns, are shown.
AllBoth horizontal and vertical grid lines are shown.

This enumeration is used by the DataGrid.GridLinesVisibility property.

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

private void cbGridLines_SelectionChanged(object sender, RoutedEventArgs e)
    ComboBoxItem cbi = ((ComboBox)sender).SelectedItem as ComboBoxItem;
    if (this.dataGrid1 != null)
        if (cbi.Content.ToString() == "All")
            this.dataGrid1.GridLinesVisibility = DataGridGridLinesVisibility.All;
        else if (cbi.Content.ToString() == "Vertical (Default)")
            this.dataGrid1.GridLinesVisibility = DataGridGridLinesVisibility.Vertical;
        else if (cbi.Content.ToString() == "Horizontal")
            this.dataGrid1.GridLinesVisibility = DataGridGridLinesVisibility.Horizontal;
            this.dataGrid1.GridLinesVisibility = DataGridGridLinesVisibility.None;



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.

Community Additions

© 2017 Microsoft