123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <UserControl x:Class="MECF.Framework.UI.Client.ClientBase.UserControls.FourArrowButton"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:cal="clr-namespace:Caliburn.Micro"
- mc:Ignorable="d"
- d:DesignHeight="70" d:DesignWidth="70">
- <UserControl.Resources>
- <ControlTemplate x:Key="ArrowButtonTemplate" TargetType="Button">
- <Viewbox>
- <Path x:Name="arrowPath"
- Data="{TemplateBinding Tag}"
- Fill="{Binding ArrowColor, RelativeSource={RelativeSource AncestorType=UserControl}}"
- Stretch="Uniform"
- RenderTransformOrigin="0.5,0.5">
- <Path.RenderTransform>
- <ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1"/>
- </Path.RenderTransform>
- </Path>
- </Viewbox>
- <ControlTemplate.Triggers>
- <!-- 鼠标悬停动画 -->
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="scaleTransform"
- Storyboard.TargetProperty="ScaleX"
- To="1.5" Duration="0:0:0.2"/>
- <DoubleAnimation Storyboard.TargetName="scaleTransform"
- Storyboard.TargetProperty="ScaleY"
- To="1.5" Duration="0:0:0.2"/>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="scaleTransform"
- Storyboard.TargetProperty="ScaleX"
- To="1" Duration="0:0:0.1"/>
- <DoubleAnimation Storyboard.TargetName="scaleTransform"
- Storyboard.TargetProperty="ScaleY"
- To="1" Duration="0:0:0.1"/>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.ExitActions>
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="arrowPath" Property="Fill" Value="{StaticResource Button_BG_Unable}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <!-- 方向箭头路径数据 -->
- <Geometry x:Key="UpArrow">M 8 14 L 16 6 24 14 20 14 20 22 12 22 12 14 8 14</Geometry>
- <Geometry x:Key="DownArrow">M 8 18 L 12 18 12 10 20 10 20 18 24 18 16 26 8 18</Geometry>
- <Geometry x:Key="LeftArrow">M 14 8 L 6 16 14 24 14 20 22 20 22 12 14 12 14 8</Geometry>
- <Geometry x:Key="RightArrow">M 18 8 L 18 12 10 12 10 20 18 20 18 24 26 16 18 8</Geometry>
- </UserControl.Resources>
- <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <!-- 上箭头 -->
- <Button Grid.Row="0" Grid.Column="1"
- Template="{StaticResource ArrowButtonTemplate}"
- Tag="{StaticResource UpArrow}"
- cal:Message.Attach="ArrowClick('Up')"/>
- <!--左箭头-->
- <Button Grid.Row="1" Grid.Column="0"
- Template="{StaticResource ArrowButtonTemplate}"
- Tag="{StaticResource LeftArrow}"
- cal:Message.Attach="ArrowClick('Left')"/>
- <!--下箭头-->
- <Button Grid.Row="2" Grid.Column="1"
- Template="{StaticResource ArrowButtonTemplate}"
- Tag="{StaticResource DownArrow}"
- cal:Message.Attach="ArrowClick('Down')"/>
- <!--右箭头-->
- <Button Grid.Row="1" Grid.Column="2"
- Template="{StaticResource ArrowButtonTemplate}"
- Tag="{StaticResource RightArrow}"
- cal:Message.Attach="ArrowClick('Right')"/>
- </Grid>
- </UserControl>
|