JD2022-TU1/main/tools/apps/JDSongConverter/View/MapSelectorControl.xaml

116 lines
6.3 KiB
XML

<UserControl x:Class="JDSongConverter.View.MapSelectorControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
mc:Ignorable="d"
d:DesignHeight="713" d:DesignWidth="568">
<UserControl.Resources>
<!-- Presenting rules of data (grouping, sorting) -->
<CollectionViewSource x:Key="cvsSongs">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Version"/>
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<componentModel:SortDescription PropertyName="Version" Direction="Descending"/>
<componentModel:SortDescription PropertyName="Name" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Songs Dirs (separated by ;)</Label>
<TextBox x:Name="SongsDirs" Grid.Row="0" Grid.Column="1" TextChanged="SongsDirs_TextChanged"></TextBox>
<Label Grid.Row="1" Grid.Column="0">Output Dir</Label>
<TextBox x:Name="OutputDir" Grid.Row="1" Grid.Column="1"></TextBox>
<Label Grid.Row="2" Grid.Column="0">Output Version</Label>
<ComboBox x:Name="OutputVersion" Grid.Row="2" Grid.Column="1" SelectedIndex="0"></ComboBox>
</Grid>
<DataGrid x:Name="DataGrid"
Grid.Row="1"
ItemsSource="{Binding Source={StaticResource cvsSongs}}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
RowHeaderWidth="0"
GridLinesVisibility="Horizontal">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Name}" Header="Name" MinWidth="220" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Version}" Header="Version" IsReadOnly="False"/>
<DataGridTextColumn Binding="{Binding Path=PlayerCount}" Header="PlayerCount" IsReadOnly="False"/>
<DataGridTextColumn Binding="{Binding Path=FolderLayout}" Header="FolderLayout" IsReadOnly="False"/>
<DataGridTextColumn Binding="{Binding Path=RootPath}" Header="Path" Width="*" IsReadOnly="True"/>
</DataGrid.Columns>
<!-- Groups Header Styles -->
<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" >
<Expander.Header>
<!-- Groups Title -->
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
<!-- Setting cells and rows colors -->
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Navy" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#44AAAAFF" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
<Button Grid.Row="2" Click="Start_Click" VerticalAlignment="Top" HorizontalAlignment="Right" Padding="2" Margin="5">
<StackPanel Orientation="Horizontal">
<Image Source="/JDSongConverter;component/Application.ico" Height="24" Width="24" Margin="4" />
<TextBlock VerticalAlignment="Center" FontWeight="Bold">Convert map(s)</TextBlock>
</StackPanel>
</Button>
</Grid>
</UserControl>