locked
How to change TextBox's InputScope using C++ code? (during runtime)

    Question

  • Hello:

        I want to change the keyboard layout of a textbox. In docs I found the InputScope property, but don't know how to manipulate it.

        code like this don't work:

    InputScopeName^ isn = ref new InputScopeName(InputScopeNameValue::TelephoneNumber);
    InputScope^ is = ref new InputScope();
    is->Names->Append(isn);
    is->SetValue(textbox_control->InputScopeProperty, isn);
    textbox_control->SetValue(textbox_control->InputScopeProperty, isn);
    textbox_control->InputScope->Dispatcher->ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessAllIfPresent);

    Thursday, August 23, 2012 10:50 AM

Answers

  • This works for me :-

    InputScope^ isc = ref new InputScope();
    InputScopeName^ iscnv = ref new InputScopeName();
    iscnv->NameValue = InputScopeNameValue::TelephoneNumber;
    
    
    isc->Names->Append(iscnv);
    
    text1->InputScope = isc;
    

    -Sagar

    • Marked as answer by mrzerg Friday, August 24, 2012 2:36 AM
    Thursday, August 23, 2012 3:22 PM
    Moderator

All replies

  • This works for me :-

    InputScope^ isc = ref new InputScope();
    InputScopeName^ iscnv = ref new InputScopeName();
    iscnv->NameValue = InputScopeNameValue::TelephoneNumber;
    
    
    isc->Names->Append(iscnv);
    
    text1->InputScope = isc;
    

    -Sagar

    • Marked as answer by mrzerg Friday, August 24, 2012 2:36 AM
    Thursday, August 23, 2012 3:22 PM
    Moderator
  • This works for me :-

    InputScope^ isc = ref new InputScope();
    InputScopeName^ iscnv = ref new InputScopeName();
    iscnv->NameValue = InputScopeNameValue::TelephoneNumber;
    
    
    isc->Names->Append(iscnv);
    
    text1->InputScope = isc;
    

    -Sagar

    works perfect, thanks
    Friday, August 24, 2012 2:37 AM