簡體   English   中英

Page.keyDown未觸發

[英]Page.keyDown not fired

我在導航窗口中有一個頁面。 我需要觸發KeyDown事件,它們不會觸發。 我有這個:

 private void gamePlayerPage_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Right)
            {
                Animate newAnimate = new Animate(this.myMapController, this);
                newAnimate.animation("right", this.myMinotaur);
            }
        }

並且它已正確連接。 有什么想法如何使它開火嗎? 謝謝

也許將其添加到您的頁面加載事件即可解決問題

Application.Current.MainWindow.KeyDown += new KeyEventHandler(MainWindow_KeyDown);

如果要轉到另一個頁面,請刪除該處理程序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM