次の表示状態の定義があります。
<VisualStateManager.CustomVisualStateManager>
<ec:ExtendedVisualStateManager/>
</VisualStateManager.CustomVisualStateManager>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="Highlight">
<VisualState x:Name="Active">
<Storyboard>
<ColorAnimation Duration="0"
To="{StaticResource PhoneAccentColor}"
Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Inactive"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
そしていくつかの長方形:
<Rectangle x:Name="A" Width="10" Height="10" Stroke="#00000000" StrokeThickness="4" />
<Rectangle x:Name="B" Width="10" Height="10" Stroke="#00000000" StrokeThickness="4" />
<Rectangle x:Name="C" Width="10" Height="10" Stroke="#00000000" StrokeThickness="4" />
<Rectangle x:Name="D" Width="10" Height="10" Stroke="#00000000" StrokeThickness="4" />
私のレイアウトルートスタックパネル内。
Active
状態を四角形 A と Cに適用したいのですが、これはExtendedVisualStateManager.GoToElementState
:
ExtendedVisualStateManager.GoToElementState(this.A, "Active", true);
ExtendedVisualStateManager.GoToElementState(this.B, "Inactive", true);
ExtendedVisualStateManager.GoToElementState(this.C, "Active", true);
ExtendedVisualStateManager.GoToElementState(this.D, "Inactive", true);
ただし、これは機能しません。アニメーションはStoryboard.TargetName
定義されていません。
GoToElementState
アニメーションをアタッチするために、ストーリーボード内で渡された最初の引数を取得するにはどうすればよいですか?