Hello,
I have a problem with the OneWay BindingMode using a XamComboEditor : the selected item is updated only the first time I change the source.
If I use the TwoWay mode it's working perfectly (but the source is updated if I change the selected item and that's not what I want).
Here's my code :
<igEditors:XamComboEditor ValuePath="ColonneName" DisplayMemberPath="LibelleSource" ItemsSource="{Binding ColGroupes}" Value="{Binding ParametresEtat/fldString1, Mode=OneWay}" HorizontalAlignment="Left" Margin="12,48,0,0" Width="155" Height="19.555" VerticalAlignment="Top" Name="cbGroupe"> <igEditors:XamComboEditor.ComboBoxStyle> <Style TargetType="{x:Type ComboBox}"> <Setter Property="IsSynchronizedWithCurrentItem" Value="true"/> </Style> </igEditors:XamComboEditor.ComboBoxStyle></igEditors:XamComboEditor>
Please do you have any suggestion ?
Thanks
When you set a Binding for a property value as you have, WPF stores that as the local value. When something changes the value of that property (e.g. control needs to set it when you select an item, type into the edit, etc.) then WPF will use that as the new local value replacing the binding that you have set. WPF treats a two way binding specially and maintains the binding and pushes the value back into the source object. This would happen for any wpf property where the object needs to set the value of its property - e.g. the Text property of a TextBox.
Just so I understand what you are trying to accomplish, you want to have the initial value come from your source, you never want changes in the control to be pushed back into your source object but the control is modifiable by the end user, and you want the Value of the control to update if the source property value changes later? So you will either need to use a two way binding, hook the ValueChanged and programatically push the value back into the source, or perhaps write your own attached property and have that programatically push changes into the Value property.
Hi Andrew,
I just ran into the same Issue as mentioned above. I am surprised, you named it a general WPF problem/feature.
Andrew Smith"] This would happen for any wpf property where the object needs to set the value of its property - e.g. the Text property of a TextBox.
This would happen for any wpf property where the object needs to set the value of its property - e.g. the Text property of a TextBox.
The Textbox.Text-property is working fine with OneWay-Binding and user-edits. I just checked that, before consulting the infragistics-forum. So it seems to me, that this is an infragistics-only issue (at least today - not sure about two years ago).
Anyway, could you give an example on any of the two solutions you suggested. I am a bit troubled on either of them.
Regards,
Thanks for the answer.
I thought that the OneWay binding was working also with an editable property :(Well, I think I'll try with the ValueChanged event...