1) 繰り返しボタンの表示状態は長方形で、押すと Stroke が透明から灰色に変わります。
この視覚的な状態の変化は、押されたときに 1 回だけ発生します。
これは繰り返しボタンなので、 を押している間、視覚状態の変化を繰り返し (押した点滅のように) 繰り返したいのですが、視覚状態を変更してそのような効果を得るにはどうすればよいですか?
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" To="Pressed"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle">
<EasingColorKeyFrame KeyTime="0" Value="#FF8F8E8E" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="rectangle" HorizontalAlignment="Stretch" Stroke="Transparent" Fill="Transparent" VerticalAlignment="Stretch" />
</Grid>
</ControlTemplate>
2)私が念頭に置いていた1つのアプローチは、クリックイベントのEventTriggerでGoToStateActionを使用することです(繰り返しボタンがそのイベントを何度も再起動するため)、
しかし、私は GoToStateAction を ControlTemplate に直接配置することはできないようです。
結論として、iv'eには2つの問題があります:
1) この問題を解決する一般的な考え方。
2) 私の考えでは、GoToStateAction を ControlTemplate オブジェクトに配置する必要があります。これは実行できないようです。これを回避する方法はありますか?
前もって感謝します。