You have to remove the item from the Item Source
How to hide DataGrid row?
Shirase
81
Reputation points
Hi all,
I want to ask you, how can I hide/show a DataGrid row? Something like
var row = dtgClients.Items[2];
row.Visibility = Visibility.Hide;
or other way, but programatically (.cs), not via xaml
Thanks
C#/WPF/DataGrid
2 answers
Sort by: Most helpful
-
-
Muthukrishnan Ramasamy 1 Reputation point
2021-06-24T18:29:20.52+00:00 Or you can use the below Style
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsVisible}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>Where IsVisible is a property in source