c# - how to refresh wpf data trigger ? -
I have the grid down with the storyboard
& Lt; DiscreteObjectKeyFrame Keytime = "0: 0: 2" value = "{x: Static Visibility. Collapsed}" /> & Lt; / ObjectAnimationUsingKeyFrames & gt; & Lt; / Storyboard & gt; & Lt; /Grid.Resources> & Lt; Grid.Style & gt; & Lt; Style & gt; & Lt; Style.Triggers & gt; & Lt; Data Trigger Value = "True" Binding = "{Binding Path = Blink Order Alert, Mode = Two}" & gt; & Lt; DataTrigger.EnterActions & gt; & Lt; StartStoreboard x: name = "Stree_ BlinkOrdAlert" Storyboard = "{Static Resources Stree_order Monjshoehide}" /> & Lt; /DataTrigger.EnterActions> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt;
and in my ViewModel.cs,
private bool blinkOrderAlert; Public Bull BlinkOrderAlert {get {return blinkOrderAlert; } Set {if (blinkOrderAlert == value) returns; This.blinkOrderAlert = Value; This.RaisePropertyChanged (this, new PropertyChangedEventArgs ("BlinkOrderAlert")); }} Public Zero BlinkOrdAlert () {this.BlinkOrderAlert = false; This.BlinkOrderAlert = True; } Public ViewModel () {this.BlinkOrderAlert = true; } And it works only for the first time when the constructor is started. Whenever I call the BlinkOrdAlert function, it is no longer working. How can I modify the DataTiger to run the storyboard, whenever I call the function? Thank you.
Consider triggering the following data into style. The following data trigger will remove the story board when the BlinkOrderAlert value is set to false and when the value is correct it will add the story board.
Hope this will help.
& lt; DataTiger value = "wrong" binding = "{binding path = blink order alert, mode = two}" & gt; & Lt; DataTrigger.EnterActions & gt; & Lt; StartStoryboard Start StoryboardName = "stry_BlinkOrdAlert" & gt; & Lt; / RemoveStoryboard & gt; & Lt; /DataTrigger.EnterActions> & Lt; / DataTrigger & gt;
Comments
Post a Comment