Closed pinki closed 7 years ago
Can you show an example of your XAML code, please?
Sure!
<TextBlock VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Text" Value="My first text"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Switch.IsEnabled, Mode=OneWay}" Value="True">
<Setter Property="Text" Value="My second text"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
The markup extension neither works in the first nor in the second setter.
I haven't tried that yet. Does the usual method not work? Maybe you need to use a more complex syntax with a separate <Setter.Value><Tx:T …/></Setter.Value>
element or similar.
You can use it as normal. Visual Studio will underline the XAML with blue colour and say that TExtension is not allowed for Setter.Value, but it will run and work as expected anyway. It's not uncommon that the WPF designer calls out errors where there are none at runtime. It's annoying but works.
Hi, is there a way to use TxTranslation inside DataTrigger Setters?