質問編集履歴
1
解決策を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -91,3 +91,69 @@
|
|
91
91
|
- Visual Studio 2019
|
92
92
|
|
93
93
|
- Windows 10
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
### 追記
|
98
|
+
|
99
|
+
リソースに、ダミーのオブジェクトを置いて、そのプロパティ経由でアニメーションさせると、動作しました。
|
100
|
+
|
101
|
+
DependencyObject のプロパティ経由じゃないとアニメーション出来ない仕様なんでしょうか……。
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```XAML
|
106
|
+
|
107
|
+
<Window ...>
|
108
|
+
|
109
|
+
<Window.Resources>
|
110
|
+
|
111
|
+
<RotateTransform x:Key="MyAnimatedTransform" Angle="0" />
|
112
|
+
|
113
|
+
<UIElement x:Key="MyAnimatedTransformHolder"
|
114
|
+
|
115
|
+
RenderTransform="{StaticResource MyAnimatedTransform}" />
|
116
|
+
|
117
|
+
</Window.Resources>
|
118
|
+
|
119
|
+
<StackPanel Margin="50">
|
120
|
+
|
121
|
+
<Button HorizontalAlignment=" Left">
|
122
|
+
|
123
|
+
Hello,World
|
124
|
+
|
125
|
+
<Button.Triggers>
|
126
|
+
|
127
|
+
<EventTrigger RoutedEvent="Button.Click">
|
128
|
+
|
129
|
+
<BeginStoryboard>
|
130
|
+
|
131
|
+
<Storyboard>
|
132
|
+
|
133
|
+
<DoubleAnimation
|
134
|
+
|
135
|
+
Storyboard.Target="{StaticResource MyAnimatedTransformHolder}"
|
136
|
+
|
137
|
+
Storyboard.TargetProperty="RenderTransform.(RotateTransform.Angle)"
|
138
|
+
|
139
|
+
From="0.0" To="360" Duration="0:0:1" />
|
140
|
+
|
141
|
+
</Storyboard>
|
142
|
+
|
143
|
+
</BeginStoryboard>
|
144
|
+
|
145
|
+
</EventTrigger>
|
146
|
+
|
147
|
+
</Button.Triggers>
|
148
|
+
|
149
|
+
</Button>
|
150
|
+
|
151
|
+
<Rectangle Fill="Red" RenderTransformOrigin="0.5,0.5" Width="100"
|
152
|
+
|
153
|
+
Height="200" RenderTransform="{StaticResource MyAnimatedTransform}" />
|
154
|
+
|
155
|
+
</StackPanel>
|
156
|
+
|
157
|
+
</Window>
|
158
|
+
|
159
|
+
```
|