Visibility of individual DataGrid rows

entity-framework wpf

Question

I own a WPF.DataGrid attached to a group ofEntity Framework items contained inside a parent EF object. Possibly along the lines of:

<DataGrid ItemsSource="{Binding SelectedCustomer.Orders}" />

Currently, I only want to change an Order's status to "delete" rather than really removing it from the data source.IsDeleted attribute to true in order to keep the data.

What I want to know is how to obtain myDataGrid if a row is empty, skip itIsDeleted is the property true? Instead of using code behind, I would really prefer to utilize binding. This kind of stuff would be great:

<DataGrid ItemsSource="{Binding SelectedCustomer.Orders}" RowVisibilityPath="IsDeleted" />

roughly in the manner ofDisplayMemberPath I am aware that I would have to change the condition ofIsDeleted but it is an another subject.

Any thoughts?

1
7
9/24/2012 7:29:21 PM

Popular Answer

You may do this using the RowStyle in addition to the previously described CollectionView:

<DataGrid.RowStyle>
    <Style TargetType="{x:Type DataGridRow}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsDeleted}" Value="True">
                <Setter Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</DataGrid.RowStyle>
24
5/8/2011 4:29:40 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow