回答編集履歴

1

見直しキャンペーン中

2023/07/29 13:05

投稿

TN8001
TN8001

スコア9862

test CHANGED
@@ -1,153 +1,77 @@
1
1
  こうですかね?(いまだにこの長ったらしいプロパティパス?よくわからんですね^^;
2
2
 
3
-
4
-
5
- ```xaml
3
+ ```xml
6
-
7
4
  <Window
8
-
9
5
  x:Class="Questions374901.MainWindow"
10
-
11
6
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
12
-
13
7
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
14
-
15
8
  Width="800"
16
-
17
9
  Height="450">
18
-
19
10
  <Window.Resources>
20
-
21
11
  <RotateTransform x:Key="ResourceAnimatedTransform" />
22
-
23
12
  </Window.Resources>
24
-
25
13
  <StackPanel Margin="50">
14
+ <Button
15
+ HorizontalAlignment="Left"
16
+ Content="MyAnimatedTransform"
17
+ RenderTransformOrigin="0.5,0.5">
18
+ <Button.RenderTransform>
19
+ <RotateTransform x:Name="MyAnimatedTransform" />
20
+ </Button.RenderTransform>
21
+ <Button.Triggers>
22
+ <EventTrigger RoutedEvent="Button.Click">
23
+ <BeginStoryboard>
24
+ <Storyboard>
25
+ <DoubleAnimation
26
+ Storyboard.TargetName="MyAnimatedTransform"
27
+ Storyboard.TargetProperty="(RotateTransform.Angle)"
28
+ From="0.0"
29
+ To="360"
30
+ Duration="0:0:1" />
31
+ </Storyboard>
32
+ </BeginStoryboard>
33
+ </EventTrigger>
34
+ </Button.Triggers>
35
+ </Button>
26
36
 
27
37
  <Button
28
-
29
38
  HorizontalAlignment="Left"
30
-
31
- Content="MyAnimatedTransform"
39
+ Content="ResourceAnimatedTransform"
32
-
40
+ RenderTransform="{StaticResource ResourceAnimatedTransform}"
33
41
  RenderTransformOrigin="0.5,0.5">
34
-
35
- <Button.RenderTransform>
36
-
37
- <RotateTransform x:Name="MyAnimatedTransform" />
38
-
39
- </Button.RenderTransform>
40
-
41
42
  <Button.Triggers>
42
-
43
43
  <EventTrigger RoutedEvent="Button.Click">
44
-
45
44
  <BeginStoryboard>
46
-
47
45
  <Storyboard>
48
-
49
46
  <DoubleAnimation
50
-
51
- Storyboard.TargetName="MyAnimatedTransform"
52
-
53
- Storyboard.TargetProperty="(RotateTransform.Angle)"
47
+ Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
54
-
55
48
  From="0.0"
56
-
57
49
  To="360"
58
-
59
50
  Duration="0:0:1" />
60
-
61
51
  </Storyboard>
62
-
63
52
  </BeginStoryboard>
64
-
65
53
  </EventTrigger>
66
-
67
54
  </Button.Triggers>
68
-
69
55
  </Button>
70
56
 
71
-
72
-
73
- <Button
57
+ <Rectangle
74
-
58
+ Width="50"
75
- HorizontalAlignment="Left"
59
+ Height="50"
76
-
77
- Content="ResourceAnimatedTransform"
60
+ Fill="Red"
78
-
79
61
  RenderTransform="{StaticResource ResourceAnimatedTransform}"
80
-
81
- RenderTransformOrigin="0.5,0.5">
62
+ RenderTransformOrigin="0.5,0.5" />
82
-
83
- <Button.Triggers>
84
-
85
- <EventTrigger RoutedEvent="Button.Click">
86
-
87
- <BeginStoryboard>
88
-
89
- <Storyboard>
90
-
91
- <DoubleAnimation
92
-
93
- Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
94
-
95
- From="0.0"
96
-
97
- To="360"
98
-
99
- Duration="0:0:1" />
100
-
101
- </Storyboard>
102
-
103
- </BeginStoryboard>
104
-
105
- </EventTrigger>
106
-
107
- </Button.Triggers>
108
-
109
- </Button>
110
-
111
-
112
-
113
63
  <Rectangle
114
-
115
64
  Width="50"
116
-
65
+ Height="100"
66
+ Fill="Green"
67
+ RenderTransform="{StaticResource ResourceAnimatedTransform}"
68
+ RenderTransformOrigin="0.5,0.5" />
69
+ <Ellipse
70
+ Width="80"
117
71
  Height="50"
118
-
119
- Fill="Red"
72
+ Fill="Blue"
120
-
121
73
  RenderTransform="{StaticResource ResourceAnimatedTransform}"
122
-
123
74
  RenderTransformOrigin="0.5,0.5" />
124
-
125
- <Rectangle
126
-
127
- Width="50"
128
-
129
- Height="100"
130
-
131
- Fill="Green"
132
-
133
- RenderTransform="{StaticResource ResourceAnimatedTransform}"
134
-
135
- RenderTransformOrigin="0.5,0.5" />
136
-
137
- <Ellipse
138
-
139
- Width="80"
140
-
141
- Height="50"
142
-
143
- Fill="Blue"
144
-
145
- RenderTransform="{StaticResource ResourceAnimatedTransform}"
146
-
147
- RenderTransformOrigin="0.5,0.5" />
148
-
149
75
  </StackPanel>
150
-
151
76
  </Window>
152
-
153
77
  ```