优化更新代码,添加界面功能并整合
This commit is contained in:
71
WPFluent/Controls/ThumbRate/ThumbRate.xaml
Normal file
71
WPFluent/Controls/ThumbRate/ThumbRate.xaml
Normal file
@@ -0,0 +1,71 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the MIT License.
|
||||
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
||||
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
||||
All Rights Reserved.
|
||||
-->
|
||||
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls">
|
||||
|
||||
<Style x:Key="DefaultUiThumbRateStyle" TargetType="{x:Type controls:ThumbRate}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ThumbRateForeground}" />
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:ThumbRate}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:Button
|
||||
Grid.Column="0"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
Command="{Binding Path=TemplateButtonCommand, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
CommandParameter="{x:Static controls:ThumbRateState.Liked}"
|
||||
Foreground="{TemplateBinding Foreground}">
|
||||
<controls:SymbolIcon
|
||||
x:Name="ThumbsUpButtonIcon"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Symbol="ThumbLike24" />
|
||||
</controls:Button>
|
||||
|
||||
<controls:Button
|
||||
Grid.Column="1"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
Command="{Binding Path=TemplateButtonCommand, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
CommandParameter="{x:Static controls:ThumbRateState.Disliked}"
|
||||
Foreground="{TemplateBinding Foreground}">
|
||||
<controls:SymbolIcon
|
||||
x:Name="ThumbsDownButtonIcon"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Symbol="ThumbDislike24" />
|
||||
</controls:Button>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="State" Value="Liked">
|
||||
<Setter TargetName="ThumbsUpButtonIcon" Property="Filled" Value="True" />
|
||||
</Trigger>
|
||||
<Trigger Property="State" Value="Disliked">
|
||||
<Setter TargetName="ThumbsDownButtonIcon" Property="Filled" Value="True" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultUiThumbRateStyle}" TargetType="{x:Type controls:ThumbRate}" />
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user