1 year ago

#212368

test-img

Mano1192

WPF MultiDataTrigger and Dynamic data

I have a style trigger that is coloring Teleriks gridview cell background a color when the cell string matches a certain text string. This code works and is shown below:

<Style TargetType="{x:Type TextBlock}">
            <Style.Triggers>
                <Trigger Property="Text" Value="Missing">
                    <Setter Property="Background" Value="LightPink"/>
                </Trigger>
            </Style.Triggers>
        </Style>

I am trying to tie that in with a toggle button in the UI so the user can turn this highlighting on/off. I have tried to use a MultiDataTrigger but I do not know the column name as the data is coming in as expando objects at runtime. Ive tried a few things, here is the latest thing Ive tried:

<Style TargetType="{x:Type TextBlock}">
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding ElementName=GridViewSchedule}" Value="Missing" />
                        <Condition Binding="{Binding ElementName=ToggleWarning, Path=IsChecked}" Value="True" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Background" Value="LightPink"/>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

Appreciate any direction you can provide! Cheers

wpf

xaml

telerik

multidatatrigger

0 Answers

Your Answer

Accepted video resources