visualstatemanager

Set custom attached property on StoryBoard

筅森魡賤 提交于 2019-12-01 05:35:54
问题 I have a storyboard and would like to set the attached property VisualStateUtility.InitialState. I've tried various combinations, but the property never gets resolved. I get the following error: Cannot resolve TargetProperty (VisualStateUtility.InitialState) How can I set the value of my custom attached property on the Storyboard? <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(Fully.Qualified.Namespace.VisualStateUtility.InitialState)" Storyboard.TargetName=

How to go back to “Base” state using VisualStateManager?

别说谁变了你拦得住时间么 提交于 2019-12-01 02:29:20
I know we can use VisualStateManager.GoToState(this,"SomeState1",true); to enter into SomeState1 , but now how to go back to the base state, like no state, the state where the control was loaded in. VisualStateManager.GoToState(this,"base",true); // OR VisualStateManager.GoToState(this,"",true); // OR VisualStateManager.GoToState(this,null,true); The problem is if there is no such way to go back to the initial or base state then I will have to always create a first state and in the contructor goto the first state in the start of control. I didnt find any documentation, so I am trying all

Binding [VisualStateManager] view state to a MVVM viewmodel?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 19:51:04
How do you bind the VisualStateManager state of a control to a property in you viewmodel? Can it be done? aL3891 Actually you can. The trick is to make an Attached property and add a property changed callback that actually calls GoToState : public class StateHelper { public static readonly DependencyProperty StateProperty = DependencyProperty.RegisterAttached( "State", typeof( String ), typeof( StateHelper ), new UIPropertyMetadata( null, StateChanged ) ); internal static void StateChanged( DependencyObject target, DependencyPropertyChangedEventArgs args ) { if( args.NewValue != null )

Binding [VisualStateManager] view state to a MVVM viewmodel?

痞子三分冷 提交于 2019-11-26 07:27:32
问题 How do you bind the VisualStateManager state of a control to a property in you viewmodel? Can it be done? 回答1: Actually you can. The trick is to make an Attached property and add a property changed callback that actually calls GoToState : public class StateHelper { public static readonly DependencyProperty StateProperty = DependencyProperty.RegisterAttached( "State", typeof( String ), typeof( StateHelper ), new UIPropertyMetadata( null, StateChanged ) ); internal static void StateChanged(