mcavanaugh418
mcavanaugh418

Reputation: 127

trying to change background color of rows in a datagrid based on multicell values

I need help binding this WPF to multiple datatriggers. I need to change row color based on two values not just the one. I wasn't able to figure out how to do that

<DataGrid.RowStyle>
   <Style TargetType="DataGridRow">
        <Style.Triggers>
            <DataTrigger Binding="{Binding AgentState}" Value="AUX-IN">
                <Setter Property="Background" Value="Green" />
                <Setter Property="Foreground" Value="White"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
 </DataGrid.RowStyle>

Upvotes: 0

Views: 44

Answers (1)

mcavanaugh418
mcavanaugh418

Reputation: 127

 <DataGrid.RowStyle>
                    <Style TargetType="DataGridRow">
                       <Style.Triggers>
                            <MultiDataTrigger>
                                <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding AgentState}" Value="ACD-IN"/>
                                    <Condition Binding="{Binding AuxReasons}" Value="General"/>
                                </MultiDataTrigger.Conditions>
                                <Setter Property="Background" Value="Green" />
                                <Setter Property="Foreground" Value="White"/>
                            </MultiDataTrigger>
                        </Style.Triggers>

                    </Style>
                </DataGrid.RowStyle>

Upvotes: 1

Related Questions