Export (0) Print
Expand All

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)

'Declaration
Public Property FrozenColumnCount As Integer
<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 Sub cbFreezeColumn_Changed(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
    Dim cb As CheckBox = sender
    If Me.dataGrid1 IsNot Nothing Then
        If cb.IsChecked = True Then
            Me.dataGrid1.FrozenColumnCount = 1
        ElseIf cb.IsChecked = False Then
            Me.dataGrid1.FrozenColumnCount = 0
        End If
    End If
End Sub


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.

Community Additions

ADD
Show:
© 2015 Microsoft