|
| 1 | +--- |
| 2 | +title: Frozen Columns |
| 3 | +page_title: .NET MAUI TreeDataGrid Documentation - Frozen Columns |
| 4 | +description: Learn how to freeze columns in Telerik TreeDataGrid for .NET MAUI. |
| 5 | +position: 4 |
| 6 | +slug: treedatagrid-frozen-columns |
| 7 | +--- |
| 8 | + |
| 9 | +# .NET MAUI TreeDataGrid Frozen Columns |
| 10 | + |
| 11 | +This article describes the frozen columns feature that the [.NET MAUI TreeDataGrid]({%slug treedatagrid-overview%}) provides. |
| 12 | + |
| 13 | +You can pin a column on the left side of the grid by setting the `IsFrozen`(`bool`) property to the column. By default the value is `False`. When setting it to `True` to a concrete column, it makes the column frozen. |
| 14 | + |
| 15 | +The next example shows how to set the frozen columns in XAML: |
| 16 | + |
| 17 | +```XAML |
| 18 | +<telerik:RadTreeDataGrid x:Name="grid" |
| 19 | + ItemsSource="{Binding Clubs}" |
| 20 | + AutoGenerateColumns="False"> |
| 21 | + <telerik:RadDataGrid.Columns> |
| 22 | + <telerik:DataGridTextColumn PropertyName="Name" |
| 23 | + IsFrozen="True" |
| 24 | + HeaderText="Name"/> |
| 25 | + </telerik:RadDataGrid.Columns> |
| 26 | +</telerik:RadTreeDataGrid> |
| 27 | +``` |
| 28 | + |
| 29 | +## Collection of Frozen Columns |
| 30 | + |
| 31 | +Once a column is frozen, it is added to the `FrozenColumns` collection (read-only collection). The collection can be used only for read-only purposes and cannot be modified. Freezing/Unfreezing the columns is done only through the `IsFrozen` property of the columns. |
| 32 | + |
| 33 | +## Styling |
| 34 | + |
| 35 | +When there is a frozen column, a splitter UI is visualized. The splitter UI splits the frozen columns from the unfrozen. |
| 36 | + |
| 37 | +You can style the frozen splitter UI using the `FrozenColumnsSplitterStyle`(`Telerik.Maui.Controls.DataGrid.DataGridFrozenColumnsSplitterStyle`) property. The `FrozenColumnsSplitterStyle` property is a property of the DataGrid. It cannot be set on a specific column. |
| 38 | + |
| 39 | +The next example shows how to style the splitter UI by using the `Width`, `BackgroundColor`, `BorderColor` and `BorderThickness` properties of the FrozenColumnsSplitterStyle class. |
| 40 | + |
| 41 | +```XAML |
| 42 | +<telerik:RadDataGrid.FrozenColumnsSplitterStyle> |
| 43 | + <telerik:DataGridFrozenColumnsSplitterStyle Width="8" |
| 44 | + BorderColor="Gray" |
| 45 | + BorderThickness="2" |
| 46 | + BackgroundColor="LightBlue"/> |
| 47 | +</telerik:RadDataGrid.FrozenColumnsSplitterStyle> |
| 48 | +``` |
| 49 | + |
| 50 | +## See Also |
| 51 | + |
| 52 | +- [Columns Cells Templates]({%slug treedatagrid-cell-templates%}) |
| 53 | +- [Column Resizing]({%slug treedatagrid-column-resizing%}) |
| 54 | +- [Columns Width]({%slug treedatagrid-columns-width%}) |
| 55 | +- [Frozen Columns]({%slug treedatagrid-frozen-columns%}) |
| 56 | +- [Columns Reordering]({%slug treedatagrid-columns-reordering%}) |
0 commit comments