WPF TextBlock MultiDataTrigger Grid.Column.Style不起作用

时间:2018-11-15 19:29:17

标签: wpf xaml multidatatrigger

我有一个TextBlock,我有一个MultiDataTrigger定义为,如果两个属性都为false,那么我希望TextBlock移至另一个网格列。问题在于整个样式根本不起作用。它甚至没有将默认的Grid.Column设置为5。请帮助。编辑帖子后,前两个文本块将折叠并正确显示

                <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 个答案:

没有答案