dimanche 28 juin 2015

WPF - Listbox SelectionChanged => Change TextBox Binding

I have a ListBox and a TextBox. The TextBox is binding to a "default"-property in my ViewModel.

What I'm trying to accomplish is that when I change the Value in the ListBox, that the property of the TextBox is changed to another property.

<ComboBox SelectedIndex="0" Name="ComboBox1">
    <ComboBoxItem>
        Messages1
    </ComboBoxItem>
    <ComboBoxItem>
        Messages2
    </ComboBoxItem>
</ComboBox>

 <TextBox Text="{Binding Messages1}" IsReadOnly="True" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" Name="LogTextBox" />

I want to change the binding of the TextBox to Messages2. I tried many things but nothing seems to work.

Is there an easy solution?

Aucun commentaire:

Enregistrer un commentaire