Handler object type for the AutoSelectOnFocus property.
Esempio n. 1
0
        /// <summary>
        /// Handles changes to the AutoSelectOnFocus property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnAutoSelectOnFocusChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool newAutoSelectOnFocus = (bool)d.GetValue(AutoSelectOnFocusProperty);

            var handler = GetAutoSelectOnFocusHandler(d);

            if (handler != null)
            {
                handler.Detach();
                SetAutoSelectOnFocusHandler(d, null);
            }

            if (newAutoSelectOnFocus)
            {
                handler = new AutoSelectOnFocusHandler((TextBox)d);
                SetAutoSelectOnFocusHandler(d, handler);
            }
        }
 public static void SetAutoSelectOnFocusHandler(DependencyObject d, AutoSelectOnFocusHandler value)
 {
     d.SetValue(AutoSelectOnFocusHandlerProperty, value);
 }
        /// <summary>
        /// Handles changes to the AutoSelectOnFocus property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnAutoSelectOnFocusChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool newAutoSelectOnFocus = (bool)d.GetValue(AutoSelectOnFocusProperty);

            var handler = GetAutoSelectOnFocusHandler(d);

            if (handler != null)
            {
                handler.Detach();
                SetAutoSelectOnFocusHandler(d, null);
            }

            if (newAutoSelectOnFocus)
            {
                handler = new AutoSelectOnFocusHandler((TextBox)d);
                SetAutoSelectOnFocusHandler(d, handler);
            }
        }
Esempio n. 4
0
 public static void SetAutoSelectOnFocusHandler(DependencyObject d, AutoSelectOnFocusHandler value)
 {
     d.SetValue(AutoSelectOnFocusHandlerProperty, value);
 }