を誘発するが、それは一度だけをトリガすることができます。使用データは、ストーリーボードを制御するトリガーが、唯一の私はいくつかのストーリーボードを制御するために、データ・トリガーを使用し1時間
<Style x:Key="PropertyTriggerExampleButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Width" Value="200" />
<Style.Triggers>
<DataTrigger Binding="{Binding para}" Value="0">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Width"
To="500" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding para}" Value="1">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Width"
To="200" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
<Button Style="{StaticResource PropertyTriggerExampleButtonStyle}">
button width will be changed
</Button>
paraは、別のボタンによって制御される変数(既にINotifyPropertyChangedインターフェイスを実装しています)です。その値は0または1
あるしかし、私はパラ値を変更するにはボタンをクリックすると、ストーリーボードは、すべての値(0と1)のために1時間をトリガーします。それは後で決して発動しません。
私は、最初のデータのトリガのExitActionsタグに二ストーリーボードを置く場合。それはうまくいくでしょう。しかし、私は
次のコードはうまく動作し...... 2つ以上のストーリーボードを制御する必要がありますが、私は多くのストーリーボードを制御する必要がある(以上2)異なる値に応じて....
<Style.Triggers>
<DataTrigger Binding="{Binding para}" Value="0">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Width" To="500" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Width" To="200" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
私はあなたのメソッドを使用します。うまくいきます。ありがとうございました。しかし、なぜ古い方法では動作しないのですか?私は非常に困惑しています..... –
トリガー間の競争があります。以下は、StoryBoardという名前のWPFの例です。 [リンク](http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ffeb5b40-e5c1-4ba1-bb95-b3d2a7ff0d2b/) – Radik
あなたの役に立つ答えをいただき、ありがとうございます。 –