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

  • Home
  • SEARCH
  • 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 6101395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:29:42+00:00 2026-05-23T13:29:42+00:00

We are writing a WPF based application that is usually used on a touchscreen

  • 0

We are writing a WPF based application that is usually used on a touchscreen tablet. We are designing the UI to avoid text input, but there times when that can’t be avoided. For those times we want to control when and what type of keyboard is popped up for input.

We can create a base custom control to add the appropriate event handler, but I was wondering if there was a way to do this by convention instead.

We are using CaliburnMicro for our MVVM framework and as it supports convention customization I started looking into ConventionManager.AddElementConvention<TextBox>(null, null, "GotFocus") but calling that will replace any existing conventions. I thought about something like:

var textboxConvention = ConventionManager.GetElementConvention(typeof(TextBox));
var oldBinding = textboxConvention.ApplyBinding;
textboxConvention.ApplyBinding = 
    (viewModelType, path, property, element, convention) =>
        {
           element.GotFocus += ((o, args) => ShowKeyboard((TextBox)o));
           element.LostFocus += ((o, args) => HideKeyboard((TextBox)o));
           return oldBinding(viewModelType, path, property, element, convention);
         };

…but I suspect I’ve gone down the wrong path here.

Is there a better way to chain bindings? Is there a better way to handling the focus events/bringing up the keyboard?

  • 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-05-23T13:29:43+00:00Added an answer on May 23, 2026 at 1:29 pm

    I’ve done this before. You can create an attached behavior that listens for PreviewGotKeyboardFocus on the element in question causing the OnScreenKeyboard to display. Then create a style that applies the attached behavior to those controls. In my project, we also had different Keyboards for different input types (for example text versus numeric). The attached behavior set a KeyboardType for its property. Based on the KeyboardType, I would display the appropriate keyboard.

    If you need further assistance let me know.

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

Sidebar

Related Questions

i am writing a commercial WPF application that needs to be copy-protected. since this
I'm writing a program in WPF application that simulates the game of life. How
I'm writing tests using WiPFlash for a WPF application that has been developed in
I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna
I'm writing a WPF application that displays terrain in 3D. When I perform hit
I'm writing a small WCF/WPF app to resize images but WCF is giving me
I am writing a fairly simple WPF desktop application and under build\configuration manager, release
I have a small WPF application based on MVVM priniciples. So far I had
I have written a WPF application that I want to port to Silverlight 2.
I am currently writing a WPF application which does command-line argument handling in App.xaml.cs

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.