Row Details Visibility Modes
In the example, the row details section is only displayed when a row is selected. This is the default row details visibility mode. There are three modes that control when the details are visible or hidden, controlled using the RowDetailsVisibilityMode property. The options are:
- Collapsed. The row details sections are always hidden from view.
- Visible. The row details sections for all of the rows are visible, whether or not rows are selected.
- VisibleWhenSelected. The default mode, where the details are shown for the selected row.
Update the opening tag of the DataGrid to switch to Visible mode.
<DataGrid Name="SampleGrid"
ItemsSource="{Binding Source={StaticResource SortedPlanets}}"
AutoGenerateColumns="False" Hyperlink.Click="DataGrid_Click"
SelectionMode="Extended" SelectionUnit="FullRow"
RowHeaderWidth="20" ColumnHeaderHeight="35" RowHeight="25"
Background="LightCyan" RowBackground="White"
AlternatingRowBackground="Aquamarine"
FrozenColumnCount="1"
VerticalGridLinesBrush="LightBlue" GridLinesVisibility="Vertical"
CanUserAddRows="False" CanUserDeleteRows="False"
RowDetailsVisibilityMode="Visible">
Run the program to see the results. You will find every row has a visible row details section.
1 December 2014