System.Windows.Controls.TextBox.ChangeVisualState C# (CSharp) Method

ChangeVisualState() private method

private ChangeVisualState ( bool useTransitions ) : void
useTransitions bool
return void
		void ChangeVisualState (bool useTransitions)
		{
			if (!IsEnabled) {
				VisualStateManager.GoToState (this, "Disabled", useTransitions);
			} else if (IsReadOnly) {
				VisualStateManager.GoToState (this, "ReadOnly", useTransitions);
			} else if (IsMouseOver) {
				VisualStateManager.GoToState (this, "MouseOver", useTransitions);
			} else {
				VisualStateManager.GoToState (this, "Normal", useTransitions);
			}
			
			if (IsFocused) {
				VisualStateManager.GoToState (this, "Focused", useTransitions);
			} else {
				VisualStateManager.GoToState (this, "Unfocused", useTransitions);
			}
		}

Same methods

TextBox::ChangeVisualState ( ) : void

Usage Example

Esempio n. 1
0
        static void IsReadOnlyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            TextBox textbox = sender as TextBox;

            textbox.ChangeVisualState(false);

            if (textbox.AutomationPeer != null)
            {
                textbox.AutomationPeer.RaisePropertyChangedEvent(ValuePatternIdentifiers.IsReadOnlyProperty,
                                                                 args.OldValue,
                                                                 args.NewValue);
            }
        }