Why the property is not called on Binding in WPF?
- by azamsharp
I am not sure why the property is not being called on Binding. Here is the code:
<myusercontrol
Text ="{Binding Description, UpdateSourceTrigger=LostFocus,Mode=TwoWay, ValidatesOnDataErrors=True}"
IsReadOnly ="{Binding AllowEditing}"
/>
And here is the myusercontrol IsReadOnly property:
public static DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof (bool),
typeof (
myusercontrol));
public bool IsReadOnly
{
get
{
return ((bool) GetValue(IsReadOnlyProperty));
}
set
{
MessageBox.Show(value.ToString());
SetValue(IsReadOnlyProperty, !value);
OnPropertyChanged("IsReadOnly");
}
}
The message box is never displayed! Any ideas!