2021-12-31 17:48:04 +00:00
|
|
|
<Window x:Class="PettingZoo.Tapeti.UI.ClassSelection.ClassSelectionWindow"
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:controls="clr-namespace:PettingZoo.WPF.Controls;assembly=PettingZoo.WPF"
|
|
|
|
xmlns:classSelection="clr-namespace:PettingZoo.Tapeti.UI.ClassSelection"
|
|
|
|
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
|
|
|
|
mc:Ignorable="d"
|
|
|
|
Title="{x:Static classSelection:ClassSelectionStrings.WindowTitle}"
|
|
|
|
Height="600"
|
|
|
|
Width="800"
|
|
|
|
ResizeMode="CanResizeWithGrip"
|
|
|
|
WindowStartupLocation="CenterOwner"
|
2022-01-03 14:00:30 +00:00
|
|
|
d:DataContext="{d:DesignInstance classSelection:DesignTimeClassSelectionViewModel, IsDesignTimeCreatable=True}"
|
|
|
|
FocusManager.FocusedElement="{Binding ElementName=DefaultFocus}">
|
2021-12-31 17:48:04 +00:00
|
|
|
<Window.Resources>
|
|
|
|
<ResourceDictionary>
|
|
|
|
<Style x:Key="TreeItemIcon" TargetType="{x:Type Image}">
|
|
|
|
<Setter Property="Margin" Value="2,2,8,2" />
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style x:Key="TreeItemLabel" TargetType="{x:Type TextBlock}">
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
|
|
<ResourceDictionary Source="pack://application:,,,/PettingZoo.WPF;component/Style.xaml"/>
|
|
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
</ResourceDictionary>
|
|
|
|
</Window.Resources>
|
|
|
|
|
|
|
|
<controls:GridLayout Style="{StaticResource Form}" Margin="8">
|
|
|
|
<Grid.RowDefinitions>
|
2022-01-03 14:00:30 +00:00
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="8"/>
|
2021-12-31 17:48:04 +00:00
|
|
|
<RowDefinition Height="*" />
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
2022-01-03 14:00:30 +00:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static classSelection:ClassSelectionStrings.LabelFilter}" />
|
|
|
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}" x:Name="DefaultFocus" />
|
|
|
|
|
|
|
|
<CheckBox Grid.Row="1" Grid.Column="1" Content="{x:Static classSelection:ClassSelectionStrings.CheckboxMessageOnly}" IsChecked="{Binding FilterMessageOnly}" />
|
|
|
|
|
|
|
|
<TreeView Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding FilteredExamples}" SelectedItemChanged="TreeView_OnSelectedItemChanged">
|
2021-12-31 17:48:04 +00:00
|
|
|
<TreeView.ItemContainerStyle>
|
|
|
|
<Style TargetType="{x:Type TreeViewItem}">
|
|
|
|
<Setter Property="IsExpanded" Value="True" />
|
|
|
|
</Style>
|
|
|
|
</TreeView.ItemContainerStyle>
|
|
|
|
<TreeView.Resources>
|
|
|
|
<HierarchicalDataTemplate DataType="{x:Type classSelection:NamespaceFolderClassTreeItem}" ItemsSource="{Binding Children}">
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
<!--
|
|
|
|
I couldn't get the image assets to work from within this assembly, so I've simply included them in the main application.
|
|
|
|
Not pretty, and it still doesn't show up in design-time, but works at runtime for now.
|
|
|
|
-->
|
|
|
|
<Image Source="{svgc:SvgImage Source=/Images/Folder.svg, AppName=PettingZoo}" Width="16" Height="16" Style="{StaticResource TreeItemIcon}"/>
|
|
|
|
<TextBlock Text="{Binding Name}" Style="{StaticResource TreeItemLabel}" />
|
|
|
|
</StackPanel>
|
|
|
|
</HierarchicalDataTemplate>
|
|
|
|
<HierarchicalDataTemplate DataType="{x:Type classSelection:ExampleTreeItem}">
|
|
|
|
<StackPanel Orientation="Horizontal">
|
2022-01-03 14:00:30 +00:00
|
|
|
<StackPanel.InputBindings>
|
|
|
|
<MouseBinding
|
|
|
|
MouseAction="LeftDoubleClick"
|
|
|
|
Command="{Binding DataContext.SelectCommand, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" />
|
|
|
|
</StackPanel.InputBindings>
|
2021-12-31 17:48:04 +00:00
|
|
|
<Image Source="{svgc:SvgImage Source=/Images/Example.svg, AppName=PettingZoo}" Width="16" Height="16" Style="{StaticResource TreeItemIcon}"/>
|
|
|
|
<TextBlock Text="{Binding Name}" Style="{StaticResource TreeItemLabel}" />
|
|
|
|
</StackPanel>
|
|
|
|
</HierarchicalDataTemplate>
|
|
|
|
</TreeView.Resources>
|
|
|
|
</TreeView>
|
|
|
|
|
2022-01-03 14:00:30 +00:00
|
|
|
<StackPanel Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Style="{StaticResource FooterPanel}">
|
2021-12-31 17:48:04 +00:00
|
|
|
<Button Content="{x:Static classSelection:ClassSelectionStrings.ButtonSelect}" Style="{StaticResource FooterButton}" Command="{Binding SelectCommand}" />
|
2022-01-03 14:00:30 +00:00
|
|
|
<Button IsCancel="True" Content="{x:Static classSelection:ClassSelectionStrings.ButtonCancel}" Style="{StaticResource FooterButton}" />
|
2021-12-31 17:48:04 +00:00
|
|
|
</StackPanel>
|
|
|
|
</controls:GridLayout>
|
|
|
|
</Window>
|