Perhaps a simple question, but... So, I have bound a text box to a property in ViewModel:
<TextBox x:Name="ololo"
Text="{Binding VM.OloloText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
And there is a TextBlock near , that could change its Text property value due to some trigger logic that I have implemented beforehand:
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=typeGallery, Path=SelectedValue}"
Value="FirstType">
<Setter Property="Text" Value="AAA" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=typeGallery, Path=SelectedValue}"
Value="Second Type">
<Setter Property="Text" Value="BBB" />
</DataTrigger>
...
So, this TextBlock has values AAA
or BBB
. All this is working like a charm.
The question is how to bind the ololo TextBox to one property, say VM.OloloText
if there is AAA
value in TextBlock and to other property (VM.ololoText2
) if TextBlock value is BBB
?