Exemple #1
0
        protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            base.OnPreviewGotKeyboardFocus(e);

            if (this.AutoSelectBehavior == AutoSelectBehavior.OnFocus)
            {
                // If the focus was not in one of our child ( or popup ), we select all the text.
                if (!TreeHelper.IsDescendantOf(e.OldFocus as DependencyObject, this))
                {
                    this.SelectAll();
                }
            }
        }
Exemple #2
0
 public static bool IsDescendantOf(DependencyObject element, DependencyObject parent)
 {
     return(TreeHelper.IsDescendantOf(element, parent, true));
 }