У меня есть usercontrol (X), который загружается в оболочку, я использую Screen / Conductors.В Control X есть tabcontrol, который я пытаюсь загрузить с другим usercontrol (Y) в качестве TabItem.Оба элемента управления имеют свои ViewModels, которые еще ничего не делят.
Usercontrol X:
[Export(typeof(IShell))]
public class CategoryViewModel : Screen, IShell
{}
Xaml в Control X:
<TabItem Header="Award Images">
<StackPanel>
<Views:ImageView cal:Bind.Model="{Binding}" />
</StackPanel>
</TabItem>
Usercontrol Y:
[Export(typeof(IShell))]
public class ImageViewModel : PropertyChangedBase, IShell
{}
Когда я запускаю приложение Iзагрузите CategoryView в оболочку и работайте нормально.ImageView загружается, но ни одна из функций не доступна.
Я ожидаю увидеть некоторые фиктивные данные, которые я помещаю в ListView в ImageView через конструктор ImageViewModel.
Любая помощь будет высоко оценена.
Спасибо.
ОБНОВЛЕНИЕ: CategoryView.xaml
<UserControl x:Name="CategoryViewUserControl"
x:Class="Central.BusinessObjects.Wpf.Views.CategoryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
xmlns:Views="clr-namespace:Central.BusinessObjects.Wpf.Views"
xmlns:Converters="clr-namespace:Central.BusinessObjects.Wpf.Converters" MinHeight="500" MinWidth="500">
<UserControl.Resources>
<ResourceDictionary>
<Converters:CategoryTypeConverter x:Key="CategoryTypeConverter" />
</ResourceDictionary>
</UserControl.Resources>
<StackPanel>
<ToolBar>
<Button Height="23" Width="75" cal:Message.Attach="SaveCategories($dataContext)">
<StackPanel Orientation="Horizontal">
<Image />
<TextBlock Text="Save" />
</StackPanel>
</Button>
</ToolBar>
<StackPanel Orientation="Horizontal">
<ComboBox x:Name="Types"
IsEditable="True"
Background="Beige"
IsReadOnly="True"
Text="Select Award Type"
DisplayMemberPath="Description"
Height="23" Width="219" />
<ComboBox x:Name="Awards"
DisplayMemberPath="Year"
Background="Beige"
Height="23" Width="120" />
<Label Content="Image" />
<TextBlock x:Name="AwardImage" TextAlignment="Justify" MinWidth="300" Background="Beige" />
<Button x:Name="BrowseAwardImage" Content="Browse" />
</StackPanel>
<TabControl>
<TabItem Header="Award Categories">
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Name" Grid.Column="0" Grid.Row="0" />
<TextBox x:Name="Description" Background="Beige" Grid.Column="1" Grid.Row="0" />
<Label Content="Reveal Time" Grid.Column="2" Grid.Row="0" />
<extToolkit:TimePicker Background="Beige"
Value="{Binding Path=RevealTime}"
Format="ShortTime"
ShowButtonSpinner="False"
Grid.Column="3" Grid.Row="0"
AllowSpin="False" />
<ComboBox x:Name="CategoryTypes"
Background="Beige"
Height="23" Width="120"
Grid.Column="4" Grid.Row="0" />
<Button Content="Add" Grid.Column="6" Grid.Row="0"
cal:Message.Attach="[Event Click] = [Action Add($dataContext)]" />
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="1" Margin="0,10,0,10">
<DataGrid x:Name="Categories" CanUserAddRows="False" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Category Name" MinWidth="500">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Description}" />
<TextBlock Text="(" Margin="10,0,0,0" />
<TextBlock Text="{Binding Path=Descriptor, Converter={StaticResource CategoryTypeConverter}, Mode=TwoWay}" />
<TextBlock Text=")" Margin="0,0,10,0" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Reveal Time" Binding="{Binding Path=RevealTime}" />
<DataGridTemplateColumn Header="Nominees">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Edit"
cal:Message.Attach="[Event Click] = [Action AddNominees(CategoryViewUserControl)]" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</ScrollViewer>
</Grid>
</StackPanel>
</TabItem>
<TabItem Header="Award Images">
<StackPanel>
<Views:ImageView cal:Bind.Model="{Binding Path=Central.BusinessObjects.Wpf.ViewModels.ImageViewModel}" />
</StackPanel>
</TabItem>
</TabControl>
</StackPanel>
ImageView.xaml
<UserControl x:Class="Central.BusinessObjects.Wpf.Views.ImageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label x:Name="LabelName" Width="Auto" Grid.Column="0" Grid.Row="0"/>
<Button x:Name="AddImages" Content="Add" Width="40" Grid.Column="1" Grid.Row="0"/>
<ListView x:Name="SelectedImages" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2">
<ListView.View>
<GridView>
<GridViewColumn Width="Auto">
<TextBlock Text="{Binding Path=ImageUri}" />
</GridViewColumn>
<GridViewColumn>
<TextBlock Text="{Binding Path=Caption}" />
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
Две модели представления полностьюв данный момент независим.