I have a collection of ViewModels that display as tabs, using a style to pull out the appropriate content to display on the tab:
public class TabViewModel : DependencyObject
{
public object Content
{
get { return (object)GetValue(ContentProperty); }
set
{
SetValue(ContentProperty, value);
}
}
}
Here's the TabControl:
<TabControl
ItemsSource={Binding MyCollectionOfTabViewModels}"
ItemContainerStyle="{StaticResource TabItemStyle}" />
And here is the style
<Style TargetType="TabItem" x:Key="TabItemStyle">
<Setter Property="Content" Value="{Binding Content}"/>
</Style>
We instantiate the usercontrol and set the Content property for the TabViewModel so that the usercontrol appears in the TabItem content area.
MyCollectionOfViewModels.Add(new TabViewModel()
{
Content = new MyUserControl();
});
My question is: I would like to enable MyUserControl (or any of its subcontrollers) added to the TabViewModel content property in order to allow raising the event that TabViewModel is handling .
Does anyone know how I will do this?
RoutedEvents RoutedCommands, - 100% MVVM. , RoutedEvent RoutedCommand, , , .
. , Prism, , - , , Prism RegionManager.