WPF TextBlock MultiDataTrigger Grid.Column.Style doesn't work

128 Views Asked by At

I have a TextBlock and I have a MultiDataTrigger defined as, if both properties are false, then I want the TextBlock to move to an other grid column. Problem is the entire style doesn't work at all. It doesn't even set the default Grid.Column to 5. Please help. Making an edit to the post, the first two textblocks are collapsed and shown correctly

                <TextBlock
                    Name="PlateBarcodeTextBlock"
                    Grid.Column="3"
                    Text="{Binding Barcode}" 
                    Visibility="{Binding ShowBarCodeForPlate,
                                 Converter={StaticResource boolToVisibility}}" />
                <!--Plate Size-->
                <TextBlock
                    Name="PlateSizeTextBlock"
                    Grid.Column="4"
                    Style="{StaticResource PlateSizeDisplayStyle}" 
                    Visibility="{Binding ShowSelectedPlateSize,
                                 Converter={StaticResource boolToVisibility}}"/>

    <TextBlock
        Name="ProtocolNameTextBlock"
        Text="{Binding ProtocolName}" >
        <TextBlock.Style>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="Grid.Column" Value="5"></Setter>
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding ShowBarCodeForPlate}"
                                       Value="False"/>
                            <Condition Binding="{Binding ShowSelectedPlateSize}"
                                       Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Grid.Column" Value="3"></Setter>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
        </TextBlock.Style>
    </TextBlock>
0

There are 0 best solutions below