JD2022-TU1/main/tools/modules/JD.Rosetta.Module/View/RosettaToolWindow.xaml

90 lines
6.4 KiB
XML

<UserControl x:Class="JD.Rosetta.Module.View.RosettaToolWindow"
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:vm="clr-namespace:JD.Rosetta.Module.ViewModel"
xmlns:controls="clr-namespace:JD.Rosetta.Module.Controls"
xmlns:optionsGrid="clr-namespace:JD.Rosetta.Module.OptionsGrid;assembly=JD.Rosetta.Module.OptionsGrid"
xmlns:view="clr-namespace:JD.Rosetta.Module.View"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance Type=vm:RosettaViewModel, IsDesignTimeCreatable=True}"
IsEnabled="{Binding IsUIEnabled}">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="330*" MinHeight="330"/>
<RowDefinition Height="5"/>
<RowDefinition Height="250*" MinHeight="250"/>
<RowDefinition Height="5"/>
<RowDefinition Height="85" MinHeight="70" MaxHeight="100"/>
</Grid.RowDefinitions>
<controls:CheckBoxList Grid.Row="0" ItemStates="{Binding ExportLanguages}" CheckOrUncheckAllBoxesText="All languages" AreAllBoxesCheckedAtStart="True"/>
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" ResizeDirection="Auto"/>
<ItemsControl Grid.Row="2" ItemsSource="{Binding ExportTypesAndOptions}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<CheckBox x:Name="ItemCheckBox" IsChecked="{Binding Key.IsChecked}" Margin="10,10,0,0" VerticalAlignment="Center" Padding="8,1,0,0">
<TextBlock Text="{Binding Key.Item}" FontSize="13">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="LayoutTransform">
<Setter.Value>
<!-- Scale up on the whole checkbox, scale down on the text so that it's not aliased -->
<!-- Done this way rather than overriding the template because keeping the presentation and style was too much hassle -->
<ScaleTransform ScaleX="0.8" ScaleY="0.8"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsChecked, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type CheckBox}}}" Value="True">
<Setter Property="FontWeight" Value="ExtraBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<CheckBox.Style>
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="1.25" ScaleY="1.25"/>
</Setter.Value>
</Setter>
</Style>
</CheckBox.Style>
</CheckBox>
<!-- Need to get precise DataContext to get PropertyFactory binding to work, but then DataObject binding must precise its own DataContext -->
<optionsGrid:ExportOptionsPropertyGrid DataObject="{Binding DataContext.Value, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UIElement}}}"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type view:RosettaToolWindow}}}"
PropertyFactory="{Binding PropertyGridDataFactory}"
Margin="27,10,10,10" HorizontalAlignment="Stretch">
<optionsGrid:ExportOptionsPropertyGrid.Style>
<Style TargetType="{x:Type optionsGrid:ExportOptionsPropertyGrid}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=ItemCheckBox}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</optionsGrid:ExportOptionsPropertyGrid.Style>
</optionsGrid:ExportOptionsPropertyGrid>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<GridSplitter Grid.Row="3" Height="5" HorizontalAlignment="Stretch" ResizeDirection="Auto"/>
<Button x:Name="ExportButton" Grid.Row="4" Content="Export" FontSize="25" VerticalContentAlignment="Center" Command="{Binding ExportLocalisationCommand}" Margin="10,15"/>
</Grid>
</ScrollViewer>
</UserControl>