Hi!
I would like to change the value of a textblock (Text property) accordingly with the selected item of a combobox. Below i show you my XAML code to design of the combobox and the textblock elements. I’m trying to use a datatrigger in the combobox but it’s not working… The reason to do this is that i need to know in my code what is the selected item of the combobox but i don’t want to use events on ViewModel. Thanks in advance!
<ComboBox x:Name=“DeviceID”
Grid.Row=“0”
Grid.Column=“1”
ItemsSource="{Binding Path=Data.DeviceID, Mode=TwoWay}"
Text=“Device Nr”
IsEditable=“False”
IsReadOnly=“True”
SelectedItem="{Binding Path=Data.DeviceID[0], Mode=TwoWay}" <span =“Apple-tab-span” style=“white-space:pre”> SelectionChanged=“DeviceID_SelectionChanged” >
<ComboBox.Triggers>
<DataTrigger Binding="{Binding ElementName=DeviceID, <span =“Apple-tab-span” style=“white-space:pre”> Path=SelectedIndex}" Value=“6”>
<Setter TargetName=“DeviceIDSelected” Property=“TextBlock.Text” <span =“Apple-tab-span” style=“white-space:pre”> Value=“OLA”/>
</ComboBox.Triggers>