Exemplo n.º 1
0
 private void InputBox_Shown(object sender, EventArgs e)
 {
     if (isdate)
     {
         datepicker.Visible = true;
         EditText.Visible   = false;
         maintable.Controls.Remove(EditText);
         maintable.Controls.Add(datepicker);
         datepicker.Focus();
     }
     else
     {
         EditText.Focus();
     }
     this.ClientSize = new Size(this.Width, maintable.Height);
 }
Exemplo n.º 2
0
        private void DisplayText_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            EscapeName             = EditText.Text;
            DisplayText.Visibility = Visibility.Collapsed;
            EditText.Visibility    = Visibility.Visible;
            EditText.SelectAll();

            /*https://stackoverflow.com/questions/13955340/keyboard-focus-does-not-work-on-text-box-in-wpf
             * WPF can have multiple Focus Scopes,
             * so multiple elements can have Logical Focus (IsFocused = true),
             * however only one element can have Keyboard Focus
             * */
            Dispatcher.BeginInvoke(DispatcherPriority.Input,
                                   new Action(delegate()
            {
                EditText.Focus();            // Set Logical Focus
                Keyboard.Focus(EditText);    // Set Keyboard Focus
            }));
        }
Exemplo n.º 3
0
        public void TriggerEdit()
        {
            CanTrigger    = false;
            PreviousValue = Text;

            EditText.Visibility = Visibility.Visible;
            EditText.FontSize   = FontSize;
            Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, new Action(() => { EditText.Focus(); }));
            EditText.SelectAll();
        }