Is there any way to hide the row detail of a WPF DataGrid? I want to show only the row in the data grid.
Thanks
<DataGrid ItemsSource="{Binding Path=oExtrationMasterList}" RowHeaderWidth="0" x:Name="DataGridMaster" AreRowDetailsFrozen="True" HorizontalAlignment="Left" Margin="15,128,0,0" VerticalAlignment="Top" Height="199" Width="614" AutoGenerateColumns="False" SelectionChanged="DataGridMaster_SelectionChanged" RowDetailsVisibilityMode="Collapsed">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Width="30" Binding="{Binding TransactionDate}" Visibility="Hidden" />
<DataGridTextColumn Header="Transaction Date" Width="*" Binding="{Binding TransactionDate}" />
<DataGridTextColumn Header="Transaction Count" Width="*" Binding="{Binding TransactionCount}" />
</DataGrid.Columns>
</DataGrid>
You have to set the RowDetailsVisibilityMode
property to Collapsed
.
RowDetailsVisibilityMode="Collapsed"
According to this this "Gets or sets a value that indicates when the details sections of rows are displayed".
In XAML you can set is like bellow:
<sdk:DataGrid RowDetailsVisibilityMode="Collapsed"/>
In C#, you can use this:
myDataGrid.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.Collapsed;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With