Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Setting the child Row foreground based on parent row property value
posted

Working with XamDataGrid, currently struggling to update the children rows based on the property value of a parent row 

The current code I have sets the foreground of the row based on a property value

(inside XamDataGrid resource)

<Style TargetType="DataPresenter:DataRecordCellArea">
    <Setter Property="BackgroundActive" Value="{StaticResource StandardBrush}" />
    <Setter Property="BackgroundHover" Value="{StaticResource StandardGBrush}" />
    <Style.Triggers>

        <DataTrigger Binding="{Binding Record.DataItem.Status, RelativeSource={RelativeSource Self}}"
                     Value="{x:Static Enums:Status.Cancelled}">
            <Setter Property="Foreground" Value="Red"/>
            <Setter Property="BorderHoverBrush" Value="Red"/>
        </DataTrigger>  

    </Style.Triggers>
</Style>

This works great, but how do i update the foreground of the children rows based on the same property?

(P.S. It does get updated when you collapse and expand again)

Parents
  • 55
    Verified Answer
    Offline posted

    Solution in the end was 

    <DataTrigger Binding="{Binding Record.ParentDataRecord.DataItem.Status, RelativeSource={RelativeSource Self}}"
                     Value="{x:Static Enums:Status.Cancelled}">
            <Setter Property="Foreground" Value="Red"/>
            <Setter Property="BorderHoverBrush" Value="Red"/>
        </DataTrigger>

Reply Children
No Data