Wpf DataGrid hide complete row through DataBinding

2019-04-07 12:20发布

Is there a possiblity to hide DataGrid-rows through DataBinding:
If I have items of a BO or a ViewModel that have a visibilty-property, is there a possibility to declare a binding so that the row will be hidden if the property is set to invisible and vice versa?

1条回答
一纸荒年 Trace。
2楼-- · 2019-04-07 12:54

It should be possible to do it via RowStyle. Something like this:

<DataGrid>
    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
            <Setter Property="Visibility" Value="{Binding Visibility}" />
        </Style>
    </DataGrid.RowStyle>
</DataGrid>
查看更多
登录 后发表回答