ServerManagers/src/ARKServerManager/Windows/DataDirectoryWindow.xaml
Brett Hewitson 0b5d7c933a Window Control Focus Changes
- set the default focus control for all the windows.
2022-06-21 11:23:10 +10:00

96 lines
6.4 KiB
XML

<Window x:Class="ServerManagerTool.Windows.DataDirectoryWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinHeight="400" MinWidth="500" Height="400" Width="500" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner" ShowInTaskbar="True" ResizeMode="CanResize"
Icon="../Art/favicon.ico" Title="{DynamicResource DataDirectory_Title}"
FocusManager.FocusedElement="{Binding ElementName=FolderNameTextBox}"
x:Name="DataDirectory">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\Globalization\en-US\en-US.xaml"/>
<ResourceDictionary Source="..\Styles\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Background="{StaticResource GradientBackground}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Margin="5" Text="{DynamicResource DataDirectory_InformationLabel}" Foreground="DarkCyan" VerticalAlignment="Center" TextWrapping="Wrap" />
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="5" Text="{DynamicResource DataDirectory_SelectionLabel}" FontWeight="Bold" VerticalAlignment="Center" TextWrapping="Wrap" />
<ListBox x:Name="DriveSelectionListBox" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Margin="5" ItemsSource="{Binding DriveInformation, ElementName=DataDirectory}" HorizontalContentAlignment="Stretch" Background="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}">
<ListBox.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="False" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="True" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Black" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{Binding Line1}" FontSize="12" FontWeight="Bold" VerticalAlignment="Center" Padding="5,5,5,0"/>
<Label Grid.Row="1" Content="{Binding Line2}" VerticalAlignment="Center" Padding="5,0,5,5"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Label Grid.Row="3" Grid.Column="0" Content="{DynamicResource DataDirectory_FolderLabel}" ToolTip="{DynamicResource DataDirectory_FolderTooltip}" />
<TextBox x:Name="FolderNameTextBox" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,5,0" Text="{Binding FolderName, ElementName=DataDirectory, Mode=TwoWay}" VerticalContentAlignment="Center" MaxLength="50" ToolTip="{DynamicResource DataDirectory_FolderTooltip}" />
<Button Grid.Row="4" Grid.Column="0" Content="{DynamicResource DataDirectory_RefreshButtonLabel}" Margin="5" MinWidth="75" HorizontalAlignment="Left" Click="Refresh_Click" Visibility="Hidden"/>
<Button Grid.Row="4" Grid.Column="1" Content="{DynamicResource DataDirectory_OkButtonLabel}" Margin="5" MinWidth="75" HorizontalAlignment="Right" Click="Ok_Click"/>
<Button Grid.Row="4" Grid.Column="2" Content="{DynamicResource DataDirectory_CancelButtonLabel}" Margin="5" MinWidth="75" HorizontalAlignment="Left" IsCancel="True"/>
</Grid>
</Window>