Skip to content

Commit

Permalink
11
Browse files Browse the repository at this point in the history
  • Loading branch information
zdy1988 committed Dec 9, 2022
1 parent 1a08e45 commit 94778e5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 62 deletions.
8 changes: 4 additions & 4 deletions src/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<local:PictureWindow.TitleBarContent>
<DockPanel>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Button x:Name="AboutButton" Style="{StaticResource PictureView.IconButton2}" Click="AboutButton_Click" ToolTip="关于">
<Button x:Name="AboutButton" Style="{StaticResource PictureView.TitleBar.IconButton}" Click="AboutButton_Click" ToolTip="关于">
<Path Data="{StaticResource Icon.About}"/>
</Button>
<Button x:Name="SettingsButton" Style="{StaticResource PictureView.IconButton2}" Click="SettingsButton_Click" ToolTip="设置">
<Button x:Name="SettingsButton" Style="{StaticResource PictureView.TitleBar.IconButton}" Click="SettingsButton_Click" ToolTip="设置">
<Path Data="{StaticResource Icon.Settings}"/>
</Button>
</StackPanel>
Expand Down Expand Up @@ -247,11 +247,11 @@
<Border x:Name="PageButton"
Visibility="{Binding CurrentPicture, Converter={StaticResource NullableToVisibilityConverter}}">
<Grid>
<Button Style="{StaticResource PictureView.IconButton4}" Click="PrevButton_Click" ToolTip="上一张"
<Button Style="{StaticResource PictureView.Navigation.IconButton}" Click="PrevButton_Click" ToolTip="上一张"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="24">
<Path Data="{StaticResource Icon.ChevronLeft}"/>
</Button>
<Button Style="{StaticResource PictureView.IconButton4}" Click="NextButton_Click" ToolTip="下一张"
<Button Style="{StaticResource PictureView.Navigation.IconButton}" Click="NextButton_Click" ToolTip="下一张"
VerticalAlignment="Center" HorizontalAlignment="Right" Margin="24">
<Path Data="{StaticResource Icon.ChevronRight}"/>
</Button>
Expand Down
77 changes: 24 additions & 53 deletions src/Themes/Zhai.PictureView.IconButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".6"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{StaticResource PictureView.IconButton.HighlightBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="0.95" ScaleY="0.95" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".6"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{StaticResource PictureView.IconButton.HighlightBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="0.95" ScaleY="0.95" />
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="PictureView.IconButton2" TargetType="Button" BasedOn="{StaticResource PictureView.IconButton}">
<Style x:Key="PictureView.TitleBar.IconButton" TargetType="Button" BasedOn="{StaticResource PictureView.IconButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
Expand All @@ -73,35 +73,18 @@
</Setter>
</Style>

<Style x:Key="PictureView.IconButton3" TargetType="Button" BasedOn="{StaticResource PictureView.IconButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ControlTemplate.Resources>
<Style TargetType="Path" BasedOn="{StaticResource PictureView.IconButton.Path}">
<Setter Property="Width" Value="12"/>
<Setter Property="Height" Value="12"/>
</Style>
</ControlTemplate.Resources>
<Grid>
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}" BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style x:Key="PictureView.TitleBar.IconCloseButton" TargetType="Button" BasedOn="{StaticResource PictureView.TitleBar.IconButton}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="PictureView.IconButton4" TargetType="Button" BasedOn="{StaticResource PictureView.IconButton}">
<Style x:Key="PictureView.Navigation.IconButton" TargetType="Button" BasedOn="{StaticResource PictureView.IconButton}">
<Setter Property="Width" Value="54"/>
<Setter Property="Height" Value="54"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
Expand All @@ -116,18 +99,6 @@
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{StaticResource PictureView.IconButton.HighlightBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="0.9" ScaleY="0.9"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down
10 changes: 5 additions & 5 deletions src/Themes/Zhai.PictureView.PictureWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@
TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
</StackPanel>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Button x:Name="PinButton" Style="{StaticResource PictureView.IconButton2}" ToolTip="置顶" Visibility="Collapsed">
<Button x:Name="PinButton" Style="{StaticResource PictureView.TitleBar.IconButton}" ToolTip="置顶" Visibility="Collapsed">
<Path x:Name="PinButtonIcon" Data="{StaticResource Icon.Pin}" RenderTransformOrigin="0.5,0.5"/>
</Button>
<Button x:Name="MinimizeButton" Style="{StaticResource PictureView.IconButton2}" ToolTip="最小化">
<Button x:Name="MinimizeButton" Style="{StaticResource PictureView.TitleBar.IconButton}" ToolTip="最小化">
<Path Data="{StaticResource Icon.MinusScreen}"/>
</Button>
<Button x:Name="MaximizeButton" Style="{StaticResource PictureView.IconButton2}" ToolTip="全屏">
<Button x:Name="MaximizeButton" Style="{StaticResource PictureView.TitleBar.IconButton}" ToolTip="全屏">
<Path Data="{StaticResource Icon.FullScreen}"/>
</Button>
<Button x:Name="RestoreButton" Style="{StaticResource PictureView.IconButton2}" Visibility="Collapsed" ToolTip="退出全屏">
<Button x:Name="RestoreButton" Style="{StaticResource PictureView.TitleBar.IconButton}" Visibility="Collapsed" ToolTip="退出全屏">
<Path Data="{StaticResource Icon.RestoreScreen}"/>
</Button>
<Button x:Name="CloseButton" Style="{StaticResource PictureView.IconButton3}" ToolTip="关闭">
<Button x:Name="CloseButton" Style="{StaticResource PictureView.TitleBar.IconCloseButton}" ToolTip="关闭">
<Path Data="{StaticResource Icon.Close}"/>
</Button>
</StackPanel>
Expand Down

0 comments on commit 94778e5

Please sign in to comment.