You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
downkyi/DownKyi/Views/MainWindow.xaml

208 lines
9.3 KiB

<Window
x:Class="DownKyi.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:DownKyi.Utils"
xmlns:prism="http://prismlibrary.com/"
Title="{DynamicResource AppName}"
Width="1100"
Height="750"
MinWidth="800"
MinHeight="550"
local:WindowAdaptation.HeightByScreenRatio="0.75"
local:WindowAdaptation.WidthByScreenRatio="0.8"
prism:ViewModelLocator.AutoWireViewModel="True"
ResizeMode="CanResize"
WindowStartupLocation="CenterScreen"
WindowState="{Binding WinState}">
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="0"
CornerRadius="0"
GlassFrameThickness="0"
NonClientFrameEdges="None"
ResizeBorderThickness="4"
UseAeroCaptionButtons="False" />
</WindowChrome.WindowChrome>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding LoadedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Border BorderBrush="{DynamicResource BrushWindowBorder}" BorderThickness="1">
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType=Window}}" Value="Maximized">
<Setter Property="Margin" Value="7,7" />
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType=Window}}" Value="Normal">
<Setter Property="Margin" Value="0" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid Background="{DynamicResource BrushBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid
Grid.Row="0"
Background="{DynamicResource BrushCaptionBackground}"
KeyboardNavigation.TabNavigation="None">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<i:InvokeCommandAction Command="{Binding DragMoveCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
Margin="10,0"
Orientation="Horizontal">
<Image
Width="20"
Height="20"
Source="/DownKyi;component/Resources/favicon.ico" />
<TextBlock
Grid.Column="0"
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushCaptionForeground}"
Text="{DynamicResource AppName}" />
</StackPanel>
<Button
Grid.Column="1"
Command="{Binding SkinCommand}"
Style="{StaticResource SystemBtnStyle}"
ToolTip="{DynamicResource Skin}"
Visibility="Collapsed">
<Path
Width="{Binding SkinIcon.Width}"
Height="{Binding SkinIcon.Height}"
Data="{Binding SkinIcon.Data}"
Fill="{Binding SkinIcon.Fill}"
Stretch="UniformToFill" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<i:InvokeCommandAction Command="{Binding SkinEnterCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave">
<i:InvokeCommandAction Command="{Binding SkinLeaveCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button
Grid.Column="2"
Command="{Binding MinimizeCommand}"
Style="{StaticResource SystemBtnStyle}"
ToolTip="{DynamicResource Minimize}">
<Path
Width="{Binding MinimizeIcon.Width}"
Height="{Binding MinimizeIcon.Height}"
Data="{Binding MinimizeIcon.Data}"
Fill="{Binding MinimizeIcon.Fill}"
Stretch="UniformToFill" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<i:InvokeCommandAction Command="{Binding MinimizeEnterCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave">
<i:InvokeCommandAction Command="{Binding MinimizeLeaveCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Grid.Column="3" Command="{Binding ResizeCommand}">
<Path
Width="{Binding ResizeIcon.Width}"
Height="{Binding ResizeIcon.Height}"
Data="{Binding ResizeIcon.Data}"
Fill="{Binding ResizeIcon.Fill}"
Stretch="UniformToFill" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<i:InvokeCommandAction Command="{Binding ResizeEnterCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave">
<i:InvokeCommandAction Command="{Binding ResizeLeaveCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Button.Style>
<Style BasedOn="{StaticResource SystemBtnStyle}" TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType=Window}}" Value="Maximized">
<Setter Property="ToolTip" Value="{DynamicResource Restore}" />
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType=Window}}" Value="Normal">
<Setter Property="ToolTip" Value="{DynamicResource Maximize}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button
Grid.Column="4"
Command="{Binding CloseCommand}"
Style="{StaticResource CloseBtnStyle}"
ToolTip="{DynamicResource Close}">
<Path
Width="{Binding CloseIcon.Width}"
Height="{Binding CloseIcon.Height}"
Data="{Binding CloseIcon.Data}"
Fill="{Binding CloseIcon.Fill}"
Stretch="UniformToFill" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<i:InvokeCommandAction Command="{Binding CloseEnterCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave">
<i:InvokeCommandAction Command="{Binding CloseLeaveCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
<ContentControl Grid.Row="1" prism:RegionManager.RegionName="ContentRegion" />
<Border
Grid.Row="1"
MinHeight="30"
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="{DynamicResource BrushBackgroundDark}"
CornerRadius="15"
Visibility="{Binding MessageVisibility}">
<TextBlock
Margin="15,5,15,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{x:Null}"
FontSize="12"
Foreground="{DynamicResource BrushForegroundDark}"
Text="{Binding Message}"
TextAlignment="Center" />
</Border>
</Grid>
</Border>
</Window>