Listen Dependency Property is Changed without event in WPF
You wanna listen any dependency property of any object is changed without event or which does not have event, here we go,
You wanna listen any dependency property of any object is changed without event or which does not have event, here we go,
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(TextBox.IsFocusedProperty, typeof(TextBox));
dpd.AddValueChanged(txtName, (s, e)=>
{
if(txtName.IsFocused)
MessageBox.Show("Focused");
});
No comments:
Post a Comment