locked
Numeric keypad only RRS feed

  • Question

  • Is it possible to display only the numeric keypad is so how?

    Sunday, October 3, 2010 7:57 AM

All replies

  • Display the numeric keypad?

    MessageBox.Show(" 7 8 9 \r\n 4 5 6 \r\n 1 2 3 ");


    ?

    Sunday, October 3, 2010 8:08 AM
  • thanks but no

    when a user goes to the textbox in the phone a keypad pops for entry

    I want to only display the numeric keypad and preferably not allow access to the alpha part

    Sunday, October 3, 2010 8:16 AM
  • cool.

    is that possible at standart Silverlight App (not for Windows Phone) ?

    thanks.

    Sunday, October 3, 2010 10:10 AM
  • How could it? The concept of a soft input panel only exists in handheld devices.

    Sunday, October 3, 2010 11:30 AM
  • @tim

    maybe mixed with ContextMenu, i do not know.

    i need this cool numpad at the TextBox or/and at NumericUpDown.

    if anyone have solution, or see it anywhere, please share it.

    thanks.

    Sunday, October 3, 2010 12:18 PM
  • Here is the xaml code to do it

                <TextBox ...>
                    <TextBox.InputScope>
                        <InputScope>
                            <InputScopeName NameValue="TelephoneNumber" />
                        </InputScope>
                    </TextBox.InputScope>
                </TextBox>

    Change the NameValue porperty to whatever keyboard you want. This shows the numbers you would use to call someone

    http://www.wintellect.com/CS/blogs/jprosise/archive/2010/05/11/understanding-input-scope-in-silverlight-for-windows-phone.aspx

    if you use this method, it wont show the intellisense
     

     
    Sunday, October 3, 2010 4:09 PM
  • Thanks for that just the job but a slight variation, in the example  it said ' NameValue = "Text" ' this did not work for me I was able to use ' NameValue = InputScopeNameValue.Number' this was preferabe to me anyway

    Below is how I applied this

    Call the routine  : LoopThroughControls(BorderName); this will loop through all the child controls in a parent, in this case a border

    public void LoopThroughControls(UIElement parent)
    {
         int count = VisualTreeHelper.GetChildrenCount(parent);
        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                UIElement localChild = (UIElement)VisualTreeHelper.GetChild(parent, i);
                string childTypeName = localChild.GetType().ToString();
                 switch (childTypeName)
                {
                    case "System.Windows.Controls.TextBox":
                        TextBox tb = ((System.Windows.Controls.TextBox)(localChild));
                        tb.InputScope = new InputScope()
                        {Names =   { new InputScopeName() { NameValue = InputScopeNameValue.Number } }};
                        break;
                    default://re-run if not a control in the switch
                        LoopThroughControls(localChild);
                        break;
                }
            }
        }
    }


     

     

    This is a list of options
    http://msdn.microsoft.com/en-us/library/system.windows.input.inputscopenamevalue(VS.95).aspx

    Monday, October 4, 2010 5:37 AM