コード例 #1
0
 private static void setTextIfUnfocused(ExtendedTextBox textBox, string text)
 {
     if (textBox.IsKeyboardFocused)
     {
         return;
     }
     textBox.SetText(text);
 }
コード例 #2
0
        private void initialise()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            if (this.textbox != null)
            {
                throw new Exception("Auto completion popup cannot be initialised more than once.");
            }

            this.textbox = this.TextBox;

            if (this.textbox == null)
            {
                throw new Exception("Auto completion popup must have a valid text box.");
            }

            this.textbox.PreviewKeyDown    += this.textboxOnPreviewKeyDown;
            this.textbox.TextChanged       += this.textboxOnTextChanged;
            this.textbox.LostKeyboardFocus += (sender, args) =>
            {
                if (this.textbox.Focusable && this.textbox.IsEnabled)
                {
                    var element = Keyboard.FocusedElement as FrameworkElement;
                    while (true)
                    {
                        if (element == null)
                        {
                            break;
                        }

                        if (element == this)
                        {
                            this.textbox.Focus();
                            return;
                        }

                        element = element.Parent as FrameworkElement;
                    }
                }

                this.close();
            };
        }
コード例 #3
0
        private void initialise()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;

            if (this.textbox != null)
                throw new Exception("Auto completion popup cannot be initialised more than once.");

            this.textbox = this.TextBox;

            if (this.textbox == null)
                throw new Exception("Auto completion popup must have a valid text box.");

            this.textbox.PreviewKeyDown += this.textboxOnPreviewKeyDown;
            this.textbox.TextChanged += this.textboxOnTextChanged;
            this.textbox.LostKeyboardFocus += (sender, args) =>
            {
                if (this.textbox.Focusable && this.textbox.IsEnabled)
                {
                    var element = Keyboard.FocusedElement as FrameworkElement;
                    while (true)
                    {
                        if (element == null)
                            break;

                        if (element == this)
                        {
                            this.textbox.Focus();
                            return;
                        }

                        element = element.Parent as FrameworkElement;
                    }
                }

                this.close();
            };
        }
コード例 #4
0
 private void setText(ExtendedTextBox textBox, string text, bool evenIfFocused)
 {
     if (evenIfFocused || !textBox.IsKeyboardFocused)
     {
         textBox.SetText(text);
     }
 }
コード例 #5
0
 private static void setTime(ExtendedTextBox textBox, string time, bool evenIfFocused)
 {
     if (evenIfFocused || !textBox.IsKeyboardFocused)
     {
         textBox.SetText(time);
         textBox.Tag = time;
     }
 }
コード例 #6
0
 private static void setTextIfUnfocused(ExtendedTextBox textBox, string text)
 {
     if (textBox.IsFocused)
         return;
     textBox.SetText(text);
 }
コード例 #7
0
        private void initialise()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;

            if (this.textbox != null)
                throw new Exception("Auto completion popup cannot be initialised more than once.");

            this.textbox = this.TextBox;

            if (this.textbox == null)
                throw new Exception("Auto completion popup must have a valid text box.");

            this.textbox.PreviewKeyDown += this.textboxOnPreviewKeyDown;
            this.textbox.TextChanged += this.textboxOnTextChanged;
            this.textbox.LostKeyboardFocus += (sender, args) => this.close();
        }
コード例 #8
0
ファイル: EditView.xaml.cs プロジェクト: flap152/toggldesktop
 private static void setTime(ExtendedTextBox textBox, string time)
 {
     textBox.SetText(time);
     textBox.Tag = time;
 }