Why the property is not called on Binding in WPF?
Posted
by azamsharp
on Stack Overflow
See other posts from Stack Overflow
or by azamsharp
Published on 2010-04-05T20:13:08Z
Indexed on
2010/04/05
20:53 UTC
Read the original article
Hit count: 284
wpf
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!
© Stack Overflow or respective owner