2

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>
Chris W.
  • 22,835
  • 3
  • 60
  • 94
nikhil
  • 1,578
  • 3
  • 23
  • 52
  • That looks syntactically correct, have you verified your bindings are valid? – Chris W. Nov 15 '18 at 19:45
  • Yes the bindings are right because I have two more textblocks which are being hidden just fine by binding to the visibility property. – nikhil Nov 15 '18 at 19:46
  • Hmmm, I mean only thing I can think of is propertychanged isn't firing on those values because as far as I can tell you're doing it correctly. +1 and hopes another pair of eyes has a remedy. – Chris W. Nov 15 '18 at 19:54
  • Thanks Chris I will try looking into it. – nikhil Nov 15 '18 at 19:56
  • Can you check if you have any possible implicit styles elsewhere in your code for `TextBlock`s? – user2619824 Nov 16 '18 at 00:26

0 Answers0