我想将GotFocus-Event添加到我的WPF-Aplication中的每个Textbox中,因为它适用于Touch Devices,每次使用TextBox时OSK都应该打开.我遇到了将事件添加到TextBoxes的过程的问题.应用程序已经构建了pc(我正在使用interhsip,我的目标是将这个应用程序带到Windows 8触摸设备).这是链接,我得到了我的灵感:添加/删除处理程序到文本框
这是我的解决方案:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
foreach (Control tb in this.Controls)
{
if (tb is TextBox)
{
TextBox tb1 = (TextBox)tb;
tb1.GotFocus += TextBox_GotFocus;
}
}
}
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
KeyBoardManager.LaunchOnScreenKeyboard();
}
Run Code Online (Sandbox Code Playgroud)
当我想运行此代码时,我有以下错误:
错误1'OSK_Test.MainWindow'不包含'Controls'的定义,也没有扩展方法'Controls'接受类型'OSK_Test.MainWindow'的第一个参数(你是否缺少using指令或程序集引用?)
我有什么需要做的,它有效吗?当然,与LostFocus一样!
我需要将2017.2至2017.3的项目表格更新为新的Vuforia版本(因为新的模型目标).播放器仍然可以正常工作.但是,如果我想为Hololens建立一个UWP应用程序.我收到错误,脚本后端不正确(使用IL2CPP).
Vuforia currently does not support the IL2CPP scripting backend for Windows Store Apps. Please select ".NET" as the scripting backend in the "Other Settings" section of the Player Settings
UnityEngine.Debug:LogError(Object)
BuildObserver:OnPreprocessBuild(BuildTarget, String)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Run Code Online (Sandbox Code Playgroud)
所以我在"设置"中更改为.NET.但现在错误是,IL2CPP构建了修补程序.
UnityException: Build path contains project built with IL2CPP scripting backend, while current project is using .NET scripting backend.
PostProcessWinRT.CheckSafeProjectOverwrite () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:303)
PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:127)
UnityEditor.WSA.BuildPostprocessor.DoPostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:117)
UnityEditor.WSA.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:124)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Run Code Online (Sandbox Code Playgroud)
那我现在该怎么办?我能改变一下吗?
这些是我原来的设置: