Files
GARbro-crskycode/ArcFormats/LiveMaker/WidgetGAL.xaml
2016-06-10 04:39:29 +04:00

46 lines
2.3 KiB
XML

<StackPanel x:Class="GameRes.Formats.GUI.WidgetGAL"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:GameRes.Formats.Strings"
xmlns:p="clr-namespace:GameRes.Formats.Properties"
xmlns:local="clr-namespace:GameRes.Formats.GUI"
MaxWidth="250" Orientation="Vertical">
<StackPanel.Resources>
<local:GaleKeyConverter x:Key="keyConverter"/>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Resources>
<Label HorizontalAlignment="Left" Margin="0,0,5,5" Padding="0">
<TextBlock Text="{x:Static s:arcStrings.GALChoose}" TextWrapping="WrapWithOverflow"/>
</Label>
<ComboBox Name="Title" ItemsSource="{Binding}"
SelectedValue="{Binding ElementName=Key, Path=Text, Converter={StaticResource keyConverter}}"
SelectedValuePath="Value" DisplayMemberPath="Key"
Width="200" HorizontalAlignment="Left"/>
<TextBox Name="Key" Width="200" HorizontalAlignment="Left" Margin="0,5,0,0">
<TextBox.Text>
<Binding Source="{x:Static p:Settings.Default}" Path="GALKey" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" Converter="{StaticResource keyConverter}">
<Binding.ValidationRules>
<local:GaleKeyRule/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
<Validation.ErrorTemplate>
<ControlTemplate>
<DockPanel>
<TextBlock DockPanel.Dock="Right" Foreground="Red" FontWeight="Bold" Text="!" VerticalAlignment="Center"/>
<Border BorderBrush="Red" BorderThickness="1">
<AdornedElementPlaceholder Name="ValidationAdorner" />
</Border>
</DockPanel>
</ControlTemplate>
</Validation.ErrorTemplate>
</TextBox>
</StackPanel>