This is a migrated thread and some comments may be shown as answers.

SelectionChanged Event - Get Last Selected RadTabItem

2 Answers 223 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Chris Andrews
Top achievements
Rank 1
Chris Andrews asked on 23 Jun 2010, 09:15 PM
Hello All,

We are in the process of converting the plain old WPF TabControl with the RadTabControl.  We have a need to get the last tab that was selected before the user clicked a new tab.

Using the WPF TabControl, in the EventArgs, there was an AddedItems and RemovedItems property.  In the RadTabControl, these do not exist.

Is there a way to get the user's last selected TabItem using this handler?

Thanks,
Chris

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 28 Jun 2010, 04:03 PM
Hi Chris Andrews,

You can use the RadTabControl PreviewSelectionChanged() event handler to get the last selected item:
private void tabControl1_PreviewSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    IList prevSelectedItems = e.RemovedItems;
    IList newSelectedItems = e.AddedItems;
}

I hope this information will help you.

Sincerely yours,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris Andrews
Top achievements
Rank 1
answered on 09 Jul 2010, 09:20 PM
Thank you for the info.  I ended up using a different approach one of my co-workers found.  I am handling the SelectionChanged event and casting e as a RadSelectionChangedEventArgs object, which does have the Added and Removed items collection.

Here is the code snippet for those interested:
void TabControl_SelectionChanged(object sender, RoutedEventArgs e)
{
    RadSelectionChangedEventArgs eArgs = e as RadSelectionChangedEventArgs;
    // We now have access to e.AddedItems and e.RemovedItems
}
Tags
TabControl
Asked by
Chris Andrews
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Chris Andrews
Top achievements
Rank 1
Share this question
or