当为button
设置property path
为rotation transform
时,我得到了error
-> 无法解析指定对象上的TargetProperty (UIElement.RenderTransform).(RotateTransform.Rotation) .
Storyboard.SetTargetProperty(animation, new PropertyPath("(UIElement.RenderTransform).(RotateTransform.Rotation)"));
<Button x:Name="btn" Content="request" Click="btn_Click">
<Button.RenderTransform>
<RotateTransform CenterX="0" />
</Button.RenderTransform>
</Button>
是路径错误还是其他什么,如果路径比正确的路径是什么?
由于
可以直接使用RotateTransform
对象。在XAML中调用它,例如:
<Button x:Name="btn" Content="request" Click="btn_Click">
<Button.RenderTransform>
<RotateTransform x:Nam="BtnRotation" CenterX="0" />
</Button.RenderTransform>
</Button>
后面的代码:
Storyboard.SetTarget(animation, BtnRotation);
Storyboard.SetTargetProperty(animation, new PropertyPath("CenterX"));