Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:25:58+00:00 2026-06-06T04:25:58+00:00

I was wondering how to click on any textbox and call upon an application

  • 0

I was wondering how to click on any textbox and call upon an application like on screen keyboard every time I click on them. Does WPF limit me to just the program or can I click on any textbox, like on browsers as well?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:26:00+00:00Added an answer on June 6, 2026 at 4:26 am

    Yes you can certainly do this – I am doing pretty much exactly what you’re asking in an SDK I have written. You can define an attached dependency property that subscribes to the focus and left click events for a textbox. These handlers then trigger the onscreen keyboard to get displayed.

    To apply this attached dependency property to all your textboxes you simply define a global style for text boxes. So the global style will look like the following. Note how both the key and target type have the same value. This is what makes your app apply it to all textboxes in the app. You just need to put this style in a global location in your app, e.g. the resources section of your App.xaml.

      <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="sdk:ClientKeyboardController.AutoShowKeyboard" Value="True"/>
      </Style>
    

    Here is a cut down version of my attached dependency property, you need to fill in the blanks to popup your on-screen keyboard:

    public class ClientKeyboardController : DependencyObject
    {
        /// <summary>
        /// <para>
        /// Set this property to true to enable the focus based keyboard popup functionality.
        /// This will request the client device show it's on-screen keyboard whenever the text
        /// box gets focus.
        /// </para>
        /// <para>
        /// Note: to hide the keyboard, either enable the AutoHideKeyboard dependency property
        /// as well, or manually hide the keyboard at an appropriate time.
        /// </para>
        /// </summary>
        public static readonly DependencyProperty AutoShowKeyboardProperty = DependencyProperty.RegisterAttached(
            "AutoShowKeyboard",
            typeof(bool),
            typeof(ClientKeyboardController),
            new PropertyMetadata(false, AutoShowKeyboardPropertyChanged));
    
        /// <summary>
        /// <see cref="AutoShowKeyboardProperty"/> getter.
        /// </summary>
        /// <param name="obj">The dependency object to get the value from.</param>
        /// <returns>Gets the value of the auto show keyboard attached property.</returns>
        [AttachedPropertyBrowsableForChildrenAttribute(IncludeDescendants = false)]
        [AttachedPropertyBrowsableForType(typeof(TextBoxBase))]
        public static bool GetAutoShowKeyboard(DependencyObject obj)
        {
            return (bool)obj.GetValue(AutoShowKeyboardProperty);
        }
    
        /// <summary>
        /// <see cref="AutoShowKeyboardProperty"/> setter.
        /// </summary>
        /// <param name="obj">The dependency object to set the value on.</param>
        /// <param name="value">The value to set.</param>
        public static void SetAutoShowKeyboard(DependencyObject obj, bool value)
        {
            obj.SetValue(AutoShowKeyboardProperty, value);
        }
    
        /// <summary>
        /// Set this property to true to enable the focus based keyboard hide functionality.
        /// This will request the client device to hide it's on-screen keyboard whenever the
        /// text box loses focus.
        /// </summary>
        public static readonly DependencyProperty AutoHideKeyboardProperty = DependencyProperty.RegisterAttached(
            "AutoHideKeyboard",
            typeof(bool),
            typeof(ClientKeyboardController),
            new PropertyMetadata(false, AutoHideKeyboardPropertyChanged));
    
        /// <summary>
        /// AutoHideKeyboard getter
        /// </summary>
        /// <param name="obj">The dependency object we want the value from.</param>
        /// <returns>Gets the value of the auto hide keyboard attached property.</returns>
        [AttachedPropertyBrowsableForChildrenAttribute(IncludeDescendants = false)]
        [AttachedPropertyBrowsableForType(typeof(TextBoxBase))]
        public static bool GetAutoHideKeyboard(DependencyObject obj)
        {
            return (bool)obj.GetValue(AutoHideKeyboardProperty);
        }
    
        /// <summary>
        /// AutoHideKeyboard setter.
        /// </summary>
        /// <param name="obj">The dependency object to set the value on.</param>
        /// <param name="value">The value to set.</param>
        public static void SetAutoHideKeyboard(DependencyObject obj, bool value)
        {
            obj.SetValue(AutoHideKeyboardProperty, value);
        }
    
        /// <summary>
        /// Handler for the AutoShowKeyboard dependency property being changed.
        /// </summary>
        /// <param name="d">Object the property is applied to.</param>
        /// <param name="e">Change args</param>
        private static void AutoShowKeyboardPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TextBoxBase textBox = d as TextBoxBase;
            if (null != textBox)
            {
                if ((e.NewValue as bool?).GetValueOrDefault(false))
                {
                    textBox.GotKeyboardFocus += OnGotKeyboardFocus;
                    textBox.PreviewMouseLeftButtonDown += OnMouseLeftButtonDown;
                }
                else
                {
                    textBox.GotKeyboardFocus -= OnGotKeyboardFocus;
                    textBox.PreviewMouseLeftButtonDown -= OnMouseLeftButtonDown;
                }
            }
        }
    
        /// <summary>
        /// Handler for the AutoHideKeyboard dependency property being changed.
        /// </summary>
        /// <param name="d">Object the property is applied to.</param>
        /// <param name="e">Change args</param>
        private static void AutoHideKeyboardPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TextBoxBase textBox = d as TextBoxBase;
            if (null != textBox)
            {
                if ((e.NewValue as bool?).GetValueOrDefault(false))
                {
                    textBox.LostKeyboardFocus += OnLostKeyboardFocus;
                }
                else
                {
                    textBox.LostKeyboardFocus -= OnLostKeyboardFocus;
                }
            }
        }
    
        /// <summary>
        /// Left click handler. We handle left clicks to ensure the text box gets focus, and if
        /// it already has focus we reshow the keyboard. This means a user can reshow the
        /// keyboard when the text box already has focus, i.e. they don't have to swap focus to
        /// another control and then back to the text box.
        /// </summary>
        /// <param name="sender">The text box that was clicked on.</param>
        /// <param name="e">The left mouse click event arguments.</param>
        private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            TextBoxBase textBox = sender as TextBoxBase;
            if (null != textBox)
            {
                if (textBox.IsKeyboardFocusWithin)
                {
                    // TODO: Show on-screen keyboard
                }
                else
                {
                    // Ensure focus is set to the text box - the focus handler will then show the
                    // keyboard.
                    textBox.Focus();
                    e.Handled = true;
                }
            }
        }
    
        /// <summary>
        /// Got focus handler. Displays the client keyboard.
        /// </summary>
        /// <param name="sender">The text box that received keyboard focus.</param>
        /// <param name="e">The got focus event arguments.</param>
        private static void OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            TextBoxBase textBox = e.OriginalSource as TextBoxBase;
            if (textBox != null)
            {
                // TODO: Show on-screen keyboard
            }
        }
    
        /// <summary>
        /// Lost focus handler. Hides the client keyboard. However we skip hiding if the new
        /// element that gains focus has got the auto-show keyboard attached property set to
        /// true. This prevents screen glitching from quickly showing/hiding the keyboard.
        /// </summary>
        /// <param name="sender">The text box that lost keyboard focus.</param>
        /// <param name="e">The lost focus event arguments.</param>
        private static void OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            TextBoxBase textBox = e.OriginalSource as TextBoxBase;
            if (textBox != null)
            {
                bool skipHide = false;
                if (e.NewFocus is DependencyObject)
                {
                    skipHide = GetAutoShowKeyboard(e.NewFocus as DependencyObject);
                }
    
                if (!skipHide && ClientKeyboardController.CmpInput != null)
                {
                    // TODO: Hide on-screen keyboard.
                }
            }
        }
    }
    

    Note that this approach only works for your current WPF application. You will need to look at hooking mechanisms if you want to do this for other processes. E.g. You could use the Microsoft Active Accessibility APIs or a hooking library like EasyHook.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just installed CodeRush Express and was wondering is there any keyboard shortcut for
I am using datatables in my application. Whenever user click on any row I
In Delphi 2009 I'm finding that any time I use TThread.CurrentThread in an application,
i was wondering how could i emulate a mouse click with c# with kinect.
I was just wondering how to create an editText field on the click of
I am wondering if I am able to modify the right-click menu of the
I'm just wondering if there is a best case to write this code: $('#set_duration_30').click(function(event)
I have two click-events, that are nearly similar, but not quite. I am wondering
Wondering if any of you can help me: I've made a signup modal that
Just wondering if there is any easy way to start a debugging session that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.