silverlight属性改变事件通知
2021-07-19 18:07
阅读:729
标签:bsp span over his text val 事件通知 ide ons
工作中遇到silverlight本身没有提供的某些属性改变事件,但又需要在属性改变时得到通知,Google搬运stack overflow,原地址


/// Listen for change of the dependency property public void RegisterForNotification(string propertyName, FrameworkElement element, PropertyChangedCallback callback) { //Bind to a depedency property Binding b = new Binding(propertyName) { Source = element }; var prop = System.Windows.DependencyProperty.RegisterAttached( "ListenAttached"+propertyName, typeof(object), typeof(UserControl), new System.Windows.PropertyMetadata(callback)); element.SetBinding(prop, b); }


RegisterForNotification("Text", this.txtMain,(d,e)=>MessageBox.Show("Text changed")); RegisterForNotification("Value", this.sliderMain, (d, e) => MessageBox.Show("Value changed"));
silverlight属性改变事件通知
标签:bsp span over his text val 事件通知 ide ons
原文地址:http://www.cnblogs.com/missile/p/7058138.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:silverlight属性改变事件通知
文章链接:http://soscw.com/index.php/essay/106362.html
文章标题:silverlight属性改变事件通知
文章链接:http://soscw.com/index.php/essay/106362.html
评论
亲,登录后才可以留言!