tags:

views:

83

answers:

1

Hello! in my MVVM application (in wpf) i have two view and I want to bind the context of my label on my textbox value (in the other view)

SelectorView.xaml contain this control: <TextBox x:Name="tbArt" value="XX"/>

DescriptionView.xaml contain this control: <label context="{binding on the tbArt value????}">

Is that possible directly without going in code behing and viewmodels ? Will the label be refresh automatically ?

Thanks !

A: 

If both of the controls databinds to the same property the label will refresh when the value is changed.Make sure that the property triggers property changed when it gets changed.

ex: in XAML.

 <TextBox x:Name="tbArt" value="{Binding Path=TheProperty, UpdateSourceTrigger=PropertyChanged}"/>
<label context="{binding TheProperty}">

in the textbox make sure you use:

UpdateSourceTrigger=PropertyChanged

. otherwise the property won't be changed until focus is shifted from the textbox.

Richard L