views:

33

answers:

1

My WPF application consists of a main window with a tab control which has a series of tab items, each hosting a user control.

I'd like one of the user controls to be able to trigger the application to change focus from the current tab to a different one.

Is there a way for the user control to trigger its tab control container to change to another tab item?

A: 

The WPF system provide the RoutedEvent. This special kind of event can be created to be catched by every element in the tree. In this way you can fire the event inside your user control, and catch it in the TabControl that will do everything you need. The tab control can catch the event cause of it lie ion the element's tree of your form

You can start from here: http://msdn.microsoft.com/en-us/library/ms742806.aspx

You'll need a Bubble Event.

Hoe this help.

Angelodev
This was helpful. Turns out that both the RoutedEvent and the classic CLR Event could do it. Thanks.
Rox Wen