Wpf DataGrid hide complete row through DataBinding

拜拜、爱过 提交于 2019-12-05 22:37:21

问题


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:


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>


来源:https://stackoverflow.com/questions/4728561/wpf-datagrid-hide-complete-row-through-databinding

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!