私は4つの視覚的状態を定義しており、それぞれが同じシルバーライトコントロール内の異なる子コントロールに影響を与えています。これらの他の組み合わせを呼び出す他の視覚的状態を作成することは可能ですか?
したがって、Visual_Group_1、Visual_Group_2、Visual_Group_3、Visual_Group_4がある場合
- たとえば、Visual_Group_1とVisual_Group_3の状態を使用するVisual_Comb_1グループを作成することは可能ですか?
- 次に、Visual_Group_4とVisual_Group_3を使用するVisual_Comb_2という別のファイルを作成しますか?
を実装できてうれしいですsolution in xaml or codebehind or a combination of both
。私が現在見ている代替案は、大量のコードのコピーと貼り付けを含み、私はそれを行うことにあまり熱心ではありません。
リクエストごとの詳細:
これは私が今大まかに持っているものです:
<VisualState x:Name="State1">
<ColorAnimation Storyboard.TargetName="Path1"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="Blue" Duration="0:0:0.5" />
// fade out the rest of the paths...
<ColorAnimation Storyboard.TargetName="Path2"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
<ColorAnimation Storyboard.TargetName="Path3"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
<ColorAnimation Storyboard.TargetName="Path4"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
</VisualState>
<VisualState x:Name="State2">
<ColorAnimation Storyboard.TargetName="Path3"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="Red" Duration="0:0:0.5" />
// fade out the rest of the paths...
<ColorAnimation Storyboard.TargetName="Path2"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
<ColorAnimation Storyboard.TargetName="Path1"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
<ColorAnimation Storyboard.TargetName="Path4"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
</VisualState>
<VisualState x:Name="State3">
<ColorAnimation Storyboard.TargetName="Path4"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="Pink" Duration="0:0:0.5" />
// fade out the rest of the paths...
<ColorAnimation Storyboard.TargetName="Path2"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
<ColorAnimation Storyboard.TargetName="Path1"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
<ColorAnimation Storyboard.TargetName="Path3"
Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#00000000" Duration="0:0:0.5" />
</VisualState>
私の目的は、state1からstate3へのサイクルをクリックすると、各状態が別のパスでフェードアウトし、他のパスでフェードアウトするコントロールを用意することです。私の問題は、「残りのパスをフェードアウトする」セクションに大量のコピーと貼り付けがあることです。したがって、Path5を追加する場合は、すでに定義されているすべての視覚的状態に追加することを意味します。フェードオフの色やアニメーションを変更するには、すべての視覚的な状態に変更する必要があります。