none
How to add Activated/Deactivated event to TabItem

    Question

  • In my WPF application I made a custom control that extends TabItem.
    The problem is that I need to know when the user selected another tab and what tab was unselected.

    How can I add those event handlers to the custom TabItem?
    I will appreciate any help.

    Michael.
    Saturday, September 06, 2008 1:29 PM

Answers

  • If you mean that your control extends TabControl you can use TabControl.SelectionChanged event and SelectionChangedEventArgs.AddedItems to get the SelectedItem and SelectionChangedEventArgs.RemovedItems to get the unselected.

    If you're using a custom control built from scratch you'll have to implement your own events and you can use the refered delegate and EventArgs.

    Bigsby, Lisboa, Portugal
    • Edited by Bigsby Monday, September 08, 2008 4:48 PM Update
    • Proposed as answer by Marco Zhou Tuesday, September 09, 2008 6:15 AM
    • Marked as answer by Marco Zhou Friday, September 12, 2008 10:07 AM
    Monday, September 08, 2008 4:44 PM