How to subscribe to change DependencyProperty? [duplicate]

送分小仙女□ 提交于 2019-12-03 23:55:41

Here is one way of doing it, using the handy DependencyPropertyDescriptor class.

 var pd = DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, typeof(TextBox));
 pd.AddValueChanged(myTextBox, OnTextChanged);


 private void OnTextChanged(object sender, EventArgs e)
 {
     ...
 }

Take a look at this article. http://msdn.microsoft.com/en-us/magazine/cc794276.aspx#id0070111. It shows how to use DPDescriptor to get changed events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!