Esempio n. 1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)this, 0);

            this.TextField   = LogicalTreeHelper.FindLogicalNode(child, "PART_ContentHost") as OverlayTextBox;
            this.ClearButton = LogicalTreeHelper.FindLogicalNode(child, "ClearSearchButton") as Button;
            if (!this.FocusOnLoaded || this.focusedAfterLoaded)
            {
                return;
            }
            UIThreadDispatcher.Instance.BeginInvoke <bool>(DispatcherPriority.Loaded, (Func <bool>)(() => this.TextField.Focus()));
        }
Esempio n. 2
0
        public static void OnTextChangedCallback(object sender, DependencyPropertyChangedEventArgs args)
        {
            OverlayTextBox overlayTextBox = sender as OverlayTextBox;

            if (overlayTextBox != null)
            {
                bool flag = !string.IsNullOrEmpty(overlayTextBox.Text);
                if (flag != overlayTextBox.HasText)
                {
                    overlayTextBox.SetValue(OverlayTextBox.HasTextPropertyKey, flag);
                }
            }
        }