Fixed Rows
- 4 minutes to read
The Table View allows you and your end-users to fix any grid row. Fixed rows can be located either at the top or at the bottom of the grid. They remain visible while the grid content is scrolled vertically.
The following animation illustrates the row fixing feature.
Enabling Row Fixing
To enable row fixing and specify the available row fixing positions, use the TableView.AllowRowFixing property.
Fixing Rows Programmatically
To fix a row programmatically, use any of the following methods:
- TableView.FixRow - Fixes a row at the top or at the bottom of the grid.
- TableView.FixItem - Fixes a row at the top or at the bottom of the grid.
The TableView supports fixing rows using the following commands:
- TableViewCommands.FixRowToBottom - Fixes a row at the bottom of the grid.
- TableViewCommands.FixRowToTop - Fixes a row at the top of the grid.
- TableViewCommands.UnFixRow - Unfixes a row.
The TableView.FixedTopRows and TableView.FixedBottomRows properties allow you to specify a list of fixed rows within the view model.
To determine whether a specific row is fixed, use the TableView.GetFixedRowPosition method. If the specified row is not fixed, the GetFixedRowPosition method returns FixedRowPosition.None.
Fixing Rows at Runtime
The TableView can display the fix row button column. The fix row buttons allow your end-users to fix grid rows at runtime. Use the TableView.ShowFixRowButton property to configure the fix row buttons.
Appearance Customization
The TableView.FixedLineHeight property specifies the height of the space that separates fixed rows from regular rows.
Example
The following example demonstrates a grid control that allows you to fix rows at the top. The fix row buttons are displayed when a user moves the mouse cursor over a grid row.
...
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
...
<dxg:GridControl ItemsSource="{Binding Data}">
<dxg:GridControl.View>
<dxg:TableView AllowRowFixing="Top" ShowFixRowButton="RowHover" FixedTopRows="{Binding FixedTopRows}"/>
</dxg:GridControl.View>
</dxg:GridControl>
Limitations
The Fixed Rows feature does not work in the following cases.
- The GridControl functions in the Server Mode.
- The GridControl functions in the master-detail mode.