【问题标题】:How do always display the Numeric keyboard in windows phone 8?如何始终在 windows phone 8 中显示数字键盘?
【发布时间】:2013-01-29 07:23:51
【问题描述】:

我正在开发 windows phone 8 应用程序,我有一个页面输入数字,我给出了这样的代码,

<TextBox Name="txtNumber" Height="Auto" Margin="0,10,0,510" >
    <TextBox.InputScope>
        <InputScope>
            <InputScopeName NameValue="Number" />
        </InputScope>
    </TextBox.InputScope>
</TextBox>

通过上面的代码;当我放置光标键入时,它会显示数字键盘;但我需要一个始终可见的固定键盘,如果我们键入它必须在文本框中输入值。

谁能告诉我怎么做。

【问题讨论】:

    标签: c# xaml windows-phone-8


    【解决方案1】:

    试穿一下尺寸:

    Xaml:

    <Grid 
        x:Name="ContentPanel" 
        Grid.Row="1" 
        Margin="12,0,12,0"
        Loaded="ContentPanel_Loaded">
        <TextBox 
            Name="TB1" 
            HorizontalAlignment="Left" 
            Height="72" 
            Margin="0,74,0,0" 
            VerticalAlignment="Top"
            Width="456"
            InputScope="Number"/>
    </Grid>
    

    代码:

    private void ContentPanel_Loaded(object sender, RoutedEventArgs e)
    {
        // Turn on Tab Stops.  You can set this in XAML as well.  
        this.IsTabStop = true;
    
        // Set focus on the TextBox.
        TB1.Focus();
    }
    

    它会在 SIP 进入 &lt;TextBox&gt; 准备输入时启动。希望它是您想要的。

    从这个MSDN blog得到它。

    【讨论】:

      【解决方案2】:

      最简单的方法可能是创建自己的用户控件。然而,让它像普通键盘一样工作很可能需要做很多工作。 http://www.silverlightshow.net/items/Creating-a-Silverlight-Custom-Control-The-Basics.aspx

      或者也许这会有所帮助http://www.silverlightshow.net/items/Windows-Phone-7-Creating-Custom-Keyboard.aspx

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-11-22
        • 2014-05-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-10
        • 1970-01-01
        相关资源
        最近更新 更多