如何在 Monogame 中从 .cs 文件导航到 .xaml?

How to navigate from .cs file to .xaml in Monogame?

尝试在 Windows 通用应用程序中导航时遇到问题。 想要使用鼠标单击从 .cs 文件导航到 .xaml,应用程序停止。 通过使用触摸应用程序可以工作,但使用点击不起作用。

我的代码如下(SexAppRetos.cs):

// Mitos
                if ( mitsTrues.Contains( mouseX, mouseY ) ) {
                    var ccc = new Frame();
                    ccc.Navigate( typeof( Credits ) );

                    Window.Current.Content = ccc;
                    Window.Current.Activate();
                }

                // Ayuda cerca de ti
                if ( help.Contains( mouseX, mouseY ) ) {
                    var rootFrame = new Frame();
                    rootFrame.Navigate( typeof( Help ) );

                    Window.Current.Content = rootFrame;
                    Window.Current.Activate();
                }

                // Faqs
                if ( faqs.Contains( mouseX, mouseY ) ) {
                    var rootFrame = new Frame();
                    rootFrame.Navigate( typeof( FaqPage ) );

                    Window.Current.Content = rootFrame;
                    Window.Current.Activate();
                }

解决方法是将鼠标点击从按下改为松开。

game.mouseState.LeftButton == ButtonState.Pressed

game.mouseState.LeftButton == ButtonState.Released