Visual State (WPF 4) をネストされたコントロールに適用できるかどうかを知りたいです。バリエーションの状態に応じて変更したい要素を含むスタック パネルがあります。
<StackPanel x:Name="panPremioRaggiunto">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StatiComuni">
<VisualState Name="PremioNonRaggiunto" />
<VisualState Name="PremioRaggiunto">
<Storyboard>
<ColorAnimation Storyboard.TargetName="lblPremioRaggiunto" Storyboard.TargetProperty="Foreground" To="Green" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock x:Name="lblPremioRaggiunto">TEXT</TextBlock>
</StackPanel>
このコードでスタックパネル全体の状態を変更しようとすると
VisualStateManager.GoToState(panPremioRaggiunto, "PremioRaggiunto", False)
何も起こりません: lblPremioRaggiunto という名前のネストされたテキストブロックは、それに応じて色を変更しません。この方法で視覚的な状態を適用できますか?
ありがとう、ダニーロ。