Observable collection base code for those without a true backing collection.
Observable sorted dictionary Grid view now displays blocks grouped by subtype. Null propagation in entity view models because WPF.
This commit is contained in:
@@ -7,30 +7,47 @@
|
||||
xmlns:viewModels="clr-namespace:Torch.Server.ViewModels"
|
||||
xmlns:entities="clr-namespace:Torch.Server.ViewModels.Entities"
|
||||
xmlns:blocks="clr-namespace:Torch.Server.ViewModels.Blocks"
|
||||
xmlns:converters="clr-namespace:Torch.Server.Views.Converters"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.DataContext>
|
||||
<viewModels:EntityTreeViewModel />
|
||||
</UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<converters:DefinitionToIdConverter x:Key="DefinitionConverter"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition MinWidth="300" Width="Auto"/>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition MinWidth="300" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TreeView Grid.Row="0" Margin="3" DockPanel.Dock="Top" SelectedItemChanged="TreeView_OnSelectedItemChanged" TreeViewItem.Expanded="TreeViewItem_OnExpanded">
|
||||
<TreeView Grid.Row="0" Margin="3" DockPanel.Dock="Top" SelectedItemChanged="TreeView_OnSelectedItemChanged"
|
||||
TreeViewItem.Expanded="TreeViewItem_OnExpanded">
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type entities:GridViewModel}" ItemsSource="{Binding Blocks}">
|
||||
<HierarchicalDataTemplate DataType="{x:Type entities:GridViewModel}"
|
||||
ItemsSource="{Binding Path=Blocks}">
|
||||
<TextBlock Text="{Binding DescriptiveName}" />
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Value.Values}">
|
||||
<TextBlock Text="{Binding Path=Key, Converter={StaticResource DefinitionConverter}, Mode=OneWay}" />
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type blocks:BlockViewModel}">
|
||||
<TextBlock Text="{Binding Path=Name}" />
|
||||
</DataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
<DataTemplate DataType="{x:Type blocks:BlockViewModel}">
|
||||
<TextBlock Text="{Binding Path=Name}" />
|
||||
</DataTemplate>
|
||||
<HierarchicalDataTemplate DataType="{x:Type entities:VoxelMapViewModel}" ItemsSource="{Binding AttachedGrids}">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<HierarchicalDataTemplate DataType="{x:Type entities:VoxelMapViewModel}"
|
||||
ItemsSource="{Binding AttachedGrids}">
|
||||
<TextBlock Text="{Binding Name}" />
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
<TreeViewItem ItemsSource="{Binding Grids}">
|
||||
<TreeViewItem ItemsSource="{Binding Path=Grids.Values}">
|
||||
<TreeViewItem.Header>
|
||||
<TextBlock Text="{Binding Grids.Count, StringFormat=Grids ({0})}" />
|
||||
</TreeViewItem.Header>
|
||||
@@ -45,7 +62,7 @@
|
||||
</DataTemplate>
|
||||
</TreeViewItem.ItemTemplate>
|
||||
</TreeViewItem>
|
||||
<TreeViewItem ItemsSource="{Binding VoxelMaps}">
|
||||
<TreeViewItem ItemsSource="{Binding VoxelMaps.Values}">
|
||||
<TreeViewItem.Header>
|
||||
<TextBlock Text="{Binding VoxelMaps.Count, StringFormat=Voxel Maps ({0})}" />
|
||||
</TreeViewItem.Header>
|
||||
@@ -55,7 +72,7 @@
|
||||
</DataTemplate>
|
||||
</TreeViewItem.ItemTemplate>
|
||||
</TreeViewItem>
|
||||
<TreeViewItem ItemsSource="{Binding FloatingObjects}">
|
||||
<TreeViewItem ItemsSource="{Binding FloatingObjects.Values}">
|
||||
<TreeViewItem.Header>
|
||||
<TextBlock Text="{Binding FloatingObjects.Count, StringFormat=Floating Objects ({0})}" />
|
||||
</TreeViewItem.Header>
|
||||
|
Reference in New Issue
Block a user