DependencyProperty changed event.

Hi,

I'm using TabItems and want to subscribe to changes to the IsSelected DependencyProperty. How can this be done

Thanks a lot




Answer this question

DependencyProperty changed event.

  • stongej2007

    Malmer wrote:

    You can always create a binding between the one you want to track and a dependencyproperty in your own class. Now if the foreign dependencyproperty changes then the binding will cause your own property that your dependencyproperty represents will be set. Just put your handling-code in the set part of the property.

    I think that will work, and it is a quite clean solution when you think of it a bit.

    Hm but I will always have to create a DependencyProperty on my Target Class and apply a binding. I think is is a big overhead compared to a simple Callback method.



  • OrenSasson

    In fact I used the SelectionChanged event of my TabControl to trigger the change. I didn't want to override something on the control because this would kill the designer functionality of Cider and Sparkle.

  • Shishir_Vaidya

    There doesn't seem to be anything else than bindings to do this.

    You can find my solution here: http://vb-magazin.de/forums/blogs/janm/



  • Abid Dar

    Have you tried overriding the property metadata for the IsSelected propety of your TabItems and specify a DepedencyPropertyChanged callback.

    While I did not try this exact case myself, this could resolve your issue of having to create a DP on your target and the binding..


  • MyRavi

    WPF knows when a DependencyProperty changes. How can I do the same Is there any way Event, apply a CallBack or something

  • leo123

    Nico Vuyge wrote:
    It is possible to override OnPropertyChanged on DependencyObject to get DependencyProperty changes.

    Of course you can.



  • SQL Servant

    You can always create a binding between the one you want to track and a dependencyproperty in your own class. Now if the foreign dependencyproperty changes then the binding will cause your own property that your dependencyproperty represents will be set. Just put your handling-code in the set part of the property.

    I think that will work, and it is a quite clean solution when you think of it a bit.


  • Edgardo Rossetto

    It is possible to override OnPropertyChanged on DependencyObject to get DependencyProperty changes.

  • DependencyProperty changed event.