简体   繁体   English

Xamarin.Forms UWP应用程序无法在XBOX上作为本机运行

[英]Xamarin.Forms UWP Application doesn't work on XBOX as native

I have tried my UWP app on XBOX one which is built using xamarin.forms and it works generally fine but by default mouse mode is active. 我已经在XBOX上尝试了我的UWP应用程序,该应用程序是使用xamarin.forms构建的,通常工作正常,但是默认情况下鼠标模式处于活动状态。 I changed it using 我用

    RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested;

on UWP level in app.xaml.cs and it disabled mouse pointer but problem is that using game pad, i am not able to select items on the UI. 在app.xaml.cs的UWP级别上,它禁用了鼠标指针,但问题是使用游戏手柄,我无法在UI上选择项目。 I can navigate through textbox and buttons but not Toolbar (Commandbar in uwp), ListView, Masterdetail, Tabs etc. 我可以浏览文本框和按钮,但不能浏览工具栏(uwp中的命令栏),ListView,Masterdetail,选项卡等。

I created a blank native UWP application and added a commandbar with AppBarButtons and NavigationView with NavigationViewItems. 我创建了一个空白的本机UWP应用程序,并添加了带有AppBarButtons的命令栏和带有NavigationViewItems的NavigationView。 It perfectly works, I am able to navigate between menu items and commanbaritems using mouse pad. 它可以完美地工作,我可以使用鼠标垫在菜单项和命令列之间导航。

Why this is not working for Xamarin.Forms? 为什么这不适用于Xamarin.Forms? is xamarin.forms not actually native for UWP? xamarin.forms实际上不是UWP的本机吗?

Xamarin.Forms MasterDetailPage was written before NavigationView existed and it doesn't use it at all (and especially not with NavigationViewItems , that would limit the flexibility, i don't think it will ever be used). Xamarin.Forms MasterDetailPage是在NavigationView存在之前编写的,它根本不使用它(尤其是不与NavigationViewItems ,那会限制灵活性,我认为它永远不会使用)。

As SplitView has some focus bug that I can confirm it doesn't come as a surprise that it doesn't work with XBox as expected. 由于SplitView有一些焦点错误,我可以确认它与XBox不能按预期工作并不奇怪。 However UWP doesn't grant that the app will work properly when you disable the mouse mode with native controls, that's why it is enabled by default. 但是,当您使用本机控件禁用鼠标模式时,UWP并不授予该应用程序正常运行的功能,这就是默认情况下启用该功能的原因。 There are properties like XYFocusLeft that must be set if the app is not working properly. 如果应用无法正常运行,则必须设置诸如XYFocusLeft类的属性。 You probably need to make custom renderer to expose those properties and set them right. 您可能需要制作自定义渲染器以显示这些属性并正确设置它们。 That's pretty much of work to do but it is up to you to decide... 要做的工作很多,但要由您决定...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM