DataGrid.FrozenColumnCount Property

Gets or sets the number of columns that the user cannot scroll horizontally.

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

public int FrozenColumnCount { get; set; }
<sdk:DataGrid FrozenColumnCount="int"/>

Property Value

Type: System.Int32
The number of non-scrolling columns.

Dependency property identifier field: FrozenColumnCountProperty

Frozen columns are columns that are always displayed and cannot be scrolled out of visibility. Frozen columns are always the leftmost columns in display order. You cannot drag frozen columns into the group of unfrozen columns or drag unfrozen columns into the group of frozen columns.

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

private void cbFreezeColumn_Changed(object sender, RoutedEventArgs e)
    CheckBox cb = sender as CheckBox;
    if (this.dataGrid1 != null)
        if (cb.IsChecked == true)
            this.dataGrid1.FrozenColumnCount = 1;
        else if (cb.IsChecked == false)
            this.dataGrid1.FrozenColumnCount = 0;


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