I have a problem with updating the value of property from code which is bind to textbox (the textbox is not displaying new value).
It was normally working without any problems but in this case source class is in separate assembly (Don't know if it is making any difference).
- If I type in textbox the value will be updated in the code
- When I change the property value directly in code textbox is not displaying new value.
- After changing the value in textbox one more time the previously set value (in code) is overwritten (so binding is still working).
Additionally I've checked if PropertyChanged event is fired and it is after every change.
Any guesses why it's not working? Below corresponding binding and source class.
TextBox Text="{Binding Path=Description, Mode=TwoWay}"
[DataContract]
public class Source : INotifyPropertyChanged
{
private String _Description;
[DataMember]
public String Description
{
get { return _Description; }
set
{
if (_Description == value)
return;
_Description = value;
OnPropertyChanged("Description");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{
var e = new PropertyChangedEventArgs(propertyName);
handler(this, e);
}
}
}
I've Fix the problem it was not connected to different assembly obviously. I have a bug in setting value to property.