修复窗口大小问题
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Szmedi.RvKits.Controls"
|
||||
xmlns:converters="clr-namespace:Szmedi.RvKits.Converters"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes">
|
||||
<!--<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>-->
|
||||
<converters:NotNullToVisibilityConverter NullValue="Collapsed" x:Key="NotNullToVisibilityConverter" />
|
||||
<converters:NotNullToVisibilityConverter x:Key="NotNullToVisibilityConverter" NullValue="Collapsed" />
|
||||
<converters:WindowTitleBarIconVisibilityConverter x:Key="WindowTitleBarIconVisibilityConverter" />
|
||||
<converters:WindowTitleVisibilityConverter x:Key="WindowTitleVisibilityConverter" />
|
||||
<converters:WindowCaptionButtonVisibilityConverter x:Key="WindowCaptionButtonVisibilityConverter" />
|
||||
<converters:WindowCaptionButtonEnabledConverter x:Key="WindowCaptionButtonEnabledConverter" />
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="WindowButtonStyle">
|
||||
<Style x:Key="WindowButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Padding" Value="8,0,8,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
@@ -25,9 +25,9 @@
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<Border
|
||||
Background="{TemplateBinding Foreground}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Foreground}">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
@@ -42,15 +42,15 @@
|
||||
</Border.Style>
|
||||
</Border>
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Stretch">
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}">
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</AdornerDecorator>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -68,9 +68,9 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="WindowMinimizeButtonStyle"
|
||||
BasedOn="{StaticResource WindowButtonStyle}"
|
||||
TargetType="{x:Type Button}"
|
||||
x:Key="WindowMinimizeButtonStyle">
|
||||
TargetType="{x:Type Button}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
@@ -92,9 +92,9 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="WindowMaximizeRestoreButtonStyle"
|
||||
BasedOn="{StaticResource WindowButtonStyle}"
|
||||
TargetType="{x:Type Button}"
|
||||
x:Key="WindowMaximizeRestoreButtonStyle">
|
||||
TargetType="{x:Type Button}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
@@ -122,33 +122,33 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="WindowCloseButtonStyle"
|
||||
BasedOn="{StaticResource WindowButtonStyle}"
|
||||
TargetType="{x:Type Button}"
|
||||
x:Key="WindowCloseButtonStyle">
|
||||
TargetType="{x:Type Button}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Setter Property="IsEnabled" Value="True" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="Background" Value="Red" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type md:PackIcon}" x:Key="WindowButtonIconStyle">
|
||||
<Style x:Key="WindowButtonIconStyle" TargetType="{x:Type md:PackIcon}">
|
||||
<Setter Property="Width" Value="24" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Foreground" Value="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TextBlock}" x:Key="WindowTitleTextBlockStyle">
|
||||
<Style x:Key="WindowTitleTextBlockStyle" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Foreground" Value="{Binding Path=BorderForegroundBrush, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type ResizeGrip}" x:Key="ResizeGripStyle">
|
||||
<Style x:Key="ResizeGripStyle" TargetType="{x:Type ResizeGrip}">
|
||||
<Setter Property="Height" Value="18" />
|
||||
<Setter Property="Width" Value="18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
@@ -160,10 +160,10 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ResizeGrip}">
|
||||
<Grid
|
||||
Background="{TemplateBinding Background}"
|
||||
Width="18"
|
||||
Height="18"
|
||||
SnapsToDevicePixels="True"
|
||||
Width="18">
|
||||
Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Rectangle">
|
||||
<Setter Property="Height" Value="2" />
|
||||
@@ -195,7 +195,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type controls:MaterialWindow}" x:Key="MaterialWindowStyle">
|
||||
<Style x:Key="MaterialWindowStyle" TargetType="{x:Type controls:MaterialWindow}">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />
|
||||
<!--<Setter Property="TitleBarIcon" Value="{Binding icon}" />-->
|
||||
@@ -219,10 +219,10 @@
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="OpacityInStoryboard">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
From="0.75"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1">
|
||||
From="0.75"
|
||||
To="1"
|
||||
Duration="0:0:0.2">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<SineEase EasingMode="EaseOut" />
|
||||
</DoubleAnimation.EasingFunction>
|
||||
@@ -230,10 +230,10 @@
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="OpacityOutStoryboard">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
From="1"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.75">
|
||||
From="1"
|
||||
To="0.75"
|
||||
Duration="0:0:0.2">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<SineEase EasingMode="EaseOut" />
|
||||
</DoubleAnimation.EasingFunction>
|
||||
@@ -254,13 +254,13 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding BorderBackgroundBrush}"
|
||||
BorderBrush="{TemplateBinding BorderBackgroundBrush}"
|
||||
ClipToBounds="True"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
ClipToBounds="True">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Style.Triggers>
|
||||
@@ -286,12 +286,12 @@
|
||||
|
||||
<!-- window icon -->
|
||||
<Image
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="8,0,8,0"
|
||||
Panel.ZIndex="2048"
|
||||
Source="{TemplateBinding Icon}"
|
||||
VerticalAlignment="Center"
|
||||
Width="24">
|
||||
Panel.ZIndex="2048"
|
||||
Source="{TemplateBinding Icon}">
|
||||
<Image.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowTitleBarIconVisibilityConverter}">
|
||||
<Binding Path="Icon" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
@@ -302,12 +302,12 @@
|
||||
|
||||
<!-- window title -->
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
Panel.ZIndex="2048"
|
||||
VerticalAlignment="Stretch">
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="2048">
|
||||
<Border.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowTitleVisibilityConverter}">
|
||||
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
@@ -332,28 +332,28 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<ContentControl
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" />
|
||||
VerticalAlignment="Stretch"
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}" />
|
||||
</Border>
|
||||
|
||||
<!-- caption buttons -->
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Height="32"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="2048"
|
||||
VerticalAlignment="Stretch">
|
||||
Orientation="Horizontal">
|
||||
<StackPanel.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowTitleVisibilityConverter}">
|
||||
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
</MultiBinding>
|
||||
</StackPanel.Visibility>
|
||||
<Button
|
||||
x:Name="minimizeButton"
|
||||
Style="{StaticResource WindowMinimizeButtonStyle}"
|
||||
ToolTip="最小化"
|
||||
x:Name="minimizeButton">
|
||||
ToolTip="最小化">
|
||||
<Button.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||||
<Binding
|
||||
@@ -375,7 +375,7 @@
|
||||
</Button.IsEnabled>
|
||||
<md:PackIcon Kind="WindowMinimize" Style="{StaticResource WindowButtonIconStyle}" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource WindowMaximizeRestoreButtonStyle}" x:Name="maximizeRestoreButton">
|
||||
<Button x:Name="maximizeRestoreButton" Style="{StaticResource WindowMaximizeRestoreButtonStyle}">
|
||||
<Button.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||||
<Binding
|
||||
@@ -411,9 +411,9 @@
|
||||
</md:PackIcon>
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="closeButton"
|
||||
Style="{StaticResource WindowCloseButtonStyle}"
|
||||
ToolTip="关闭"
|
||||
x:Name="closeButton">
|
||||
ToolTip="关闭">
|
||||
<Button.Visibility>
|
||||
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||||
<Binding
|
||||
@@ -439,13 +439,13 @@
|
||||
|
||||
<!-- window content -->
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Panel.ZIndex="2047"
|
||||
VerticalAlignment="Stretch">
|
||||
Background="{TemplateBinding Background}">
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}">
|
||||
<ContentPresenter.Style>
|
||||
@@ -472,11 +472,11 @@
|
||||
|
||||
<!-- resize grip -->
|
||||
<ResizeGrip
|
||||
Grid.Column="2"
|
||||
x:Name="resizeGrip"
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Panel.ZIndex="2048"
|
||||
Style="{StaticResource ResizeGripStyle}"
|
||||
x:Name="resizeGrip" />
|
||||
Style="{StaticResource ResizeGripStyle}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
Reference in New Issue
Block a user