How do I handle Canvas.Top change event in WPF?

前端 未结 1 2001
青春惊慌失措
青春惊慌失措 2020-12-16 01:56

I have an element positioned on Canvas using attached properties Canvas.Top and Canvas.Left. Then using animations the element is move

相关标签:
1条回答
  • 2020-12-16 02:08

    One can catch attached property changed event using DependencyPropertyDescriptor's AddValueChanged method:

    var descriptor 
        = DependencyPropertyDescriptor.FromProperty( 
            Canvas.LeftProperty, typeof( YourControlType ) 
          );
    descriptor.AddValueChanged( this, OnCanvasLeftChanged );
    
    0 讨论(0)
提交回复
热议问题