Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

DataGrid.HorizontalScrollBarVisibility Property

Gets or sets a value that indicates how the horizontal scroll bar is displayed.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)
public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
<sdk:DataGrid HorizontalScrollBarVisibility="scrollBarVisibilityValue"/>

XAML Values


A named constant of the ScrollBarVisibility enumeration, such as Disabled.

Property Value

Type: System.Windows.Controls.ScrollBarVisibility
One of the enumeration values that specifies the horizontal scroll bar visibility. The default is Auto.

Dependency property identifier field: HorizontalScrollBarVisibilityProperty

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

private void cbHorizontalScroll_Changed(object sender, RoutedEventArgs e)
    CheckBox cb = sender as CheckBox;
    if (this.dataGrid1 != null)
        if (cb.IsChecked == true)
            this.dataGrid1.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
        else if (cb.IsChecked == false)
            this.dataGrid1.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            this.dataGrid1.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;



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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.