【问题标题】:C# - How to shift focus from one text box to another?C# - 如何将焦点从一个文本框转移到另一个?
【发布时间】:2014-11-29 08:15:35
【问题描述】:

我写的代码如下:

 private void a1_1_TextChanged(object sender, TextChangedEventArgs e)
       {
        if (a1_1.Text.Length == 1)
            a1_2.Focus();
       }

这在 Windows 8.0 应用中运行良好。

在 Windows 8.1 中,我收到“焦点的重载方法不接受 0 个参数”的错误。

请帮忙

提前谢谢你

我很抱歉,因为这个问题是基本的,而且由于我是 Windows 8 编程的新手,所以我不知道。

【问题讨论】:

    标签: c# xaml windows-phone-8 windows-phone-8.1


    【解决方案1】:

    在您的 Focus 方法中传递一个值。该方法以FoucsState 作为参数

    a1_2.Focus(FocusState.Programmatic) 
    

    或来自this的任何其他值

    【讨论】:

    • 谢谢。我以前试过。但我收到错误消息。 "Windows.UI.Xaml.Controls.Control.Focus(Windows.UI.Xaml.FocusState) 的最佳重载方法匹配有一些无效参数
    猜你喜欢
    • 2010-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-31
    相关资源
    最近更新 更多