WPF图标旋转

时间:2019-02-21 08:23:23

标签: wpf xaml font-awesome

基于this的答案,我有两个问题:

  
      
  1. 标记图标的名称是什么?
  2.   

enter image description here

  
      
  1. 如何使它向另一个方向旋转,即像这样旋转:
  2.   

enter image description here

试图添加FlowDirection="RightToLeft",例如:

<fa:ImageAwesome FlowDirection="RightToLeft" SpinDuration="6" Icon="Cog" Width="200" Height="200" Foreground="White" Spin="True" />

但它仍会向同一方向旋转

1 个答案:

答案 0 :(得分:2)

这应该为您解决问题:

            <Viewbox Height="20">                
            <Path Fill="black" Data="M28,2.202v4.059C37.053,7.706,44,15.547,44,25c0,10.477-8.523,19-19,19S6,35.477,6,25c0-9.442,6.93-17.275,15.966-18.734 V2.206C10.713,3.696,2,13.347,2,25c0,12.682,10.317,23,23,23s23-10.318,23-23C48,13.335,39.269,3.677,28,2.202z">
                <Path.RenderTransform>
                    <RotateTransform CenterX="25" CenterY="25" />
                </Path.RenderTransform>
                <Path.Style>
                    <Style>
                        <Style.Triggers>
                            <Trigger Property="Image.IsEnabled" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation
                                    Storyboard.TargetProperty="RenderTransform.Angle"
                                    From="0"
                                    To="360"
                                    Duration="0:0:1"
                                    RepeatBehavior="Forever" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Path.Style>
            </Path>
        </Viewbox>