System.Windows.Controls.VisualStates.GoToState C# (CSharp) Method

GoToState() public static method

Use VisualStateManager to change the visual state of the control.
public static GoToState ( Control control, bool useTransitions ) : void
control Control /// Control whose visual state is being changed. ///
useTransitions bool /// A value indicating whether to use transitions when updating the /// visual state, or to snap directly to the new visual state. ///
return void
        public static void GoToState(Control control, bool useTransitions, params string[] stateNames)
        {
            Debug.Assert(control != null, "control should not be null!");
            Debug.Assert(stateNames != null, "stateNames should not be null!");
            Debug.Assert(stateNames.Length > 0, "stateNames should not be empty!");

            foreach(string name in stateNames)
            {
                if(VisualStateManager.GoToState(control, name, useTransitions))
                {
                    break;
                }
            }
        }

Usage Example

Example #1
0
 // Token: 0x060056BE RID: 22206 RVA: 0x0014E788 File Offset: 0x0014C988
 internal override void ChangeVisualState(bool useTransitions)
 {
     if (!base.IsEnabled)
     {
         VisualStates.GoToState(this, useTransitions, new string[]
         {
             "Disabled",
             "Normal"
         });
     }
     else
     {
         VisualStateManager.GoToState(this, "Normal", useTransitions);
     }
     base.ChangeVisualState(useTransitions);
 }
All Usage Examples Of System.Windows.Controls.VisualStates::GoToState