Mark van Renswoude
c75ea0cc62
Fixed class name missing when selecting from Tapeti class Added Filter to class selection dialog Fixed or removed some minor todo's
89 lines
5.2 KiB
XML
89 lines
5.2 KiB
XML
<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"
|
|
d:DataContext="{d:DesignInstance classSelection:DesignTimeClassSelectionViewModel, IsDesignTimeCreatable=True}"
|
|
FocusManager.FocusedElement="{Binding ElementName=DefaultFocus}">
|
|
<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>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="8"/>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<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">
|
|
<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">
|
|
<StackPanel.InputBindings>
|
|
<MouseBinding
|
|
MouseAction="LeftDoubleClick"
|
|
Command="{Binding DataContext.SelectCommand, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" />
|
|
</StackPanel.InputBindings>
|
|
<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>
|
|
|
|
<StackPanel Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Style="{StaticResource FooterPanel}">
|
|
<Button Content="{x:Static classSelection:ClassSelectionStrings.ButtonSelect}" Style="{StaticResource FooterButton}" Command="{Binding SelectCommand}" />
|
|
<Button IsCancel="True" Content="{x:Static classSelection:ClassSelectionStrings.ButtonCancel}" Style="{StaticResource FooterButton}" />
|
|
</StackPanel>
|
|
</controls:GridLayout>
|
|
</Window>
|