Ok I have two observable collections drawn from the same binary file as follows
Code:
public ObservableCollection<Model.CourseAsset> AllCourseAssets
{
get;
private set;
}
public ObservableCollection<Model.AssetType> AllAssetTypes
{
get;
private set;
}
public CourseAssetListViewModel(CourseRepository courseRepository)
{
if (courseRepository == null)
{
throw new ArgumentNullException("courseRepository");
}
_courseRepository = courseRepository;
this.AllCourseAssets = new ObservableCollection<Model.CourseAsset>(_courseRepository.GetCourseAssets());
this.AllAssetTypes = new ObservableCollection<Model.AssetType>(_courseRepository.GetAssetTypes());
}
I have in my XAML the following
Code:
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="200" />
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Height="40" HorizontalAlignment="Left" Margin="6,6,0,0" Name="dockPanel1" VerticalAlignment="Top" Width="783">
<Label Content="Please select the type of resource from the following drop down" Height="24" Name="label1" IsEnabled="False" Foreground="Black" />
<ComboBox Width="372" Margin="10" ItemsSource="{Binding AllAssetTypes}" SelectedItem="{Binding Path=CurrentElement}"
Height="20" ScrollViewer.VerticalScrollBarVisibility="Visible" IsSynchronizedWithCurrentItem="True">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=AssetFiletype}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
<DockPanel Grid.Row="1" Width="783">
<ListBox x:Name="AssetSelection">
<ItemsControl ItemsSource="{Binding AllCourseAssets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Width="10" Text="{Binding Id}" />
<TextBlock Width="280" Text="{Binding Description}" />
<TextBlock Width="500" Text="{Binding AssetData}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ListBox>
</DockPanel>
</Grid>
What I am trying to do is derive the list of detail in the second grid row by what is selected in the combobox
The data is a list of assets in a binary file. I add all the assets into the first observable collection and then do a linq to object Distinct() to get the second observable collection which is the list of asset types in the data file.
Any help on how to do this is greatly appreciated.
Andrew