• <small id='LcGLp'></small><noframes id='LcGLp'>

    <tfoot id='LcGLp'></tfoot>

    1. <i id='LcGLp'><tr id='LcGLp'><dt id='LcGLp'><q id='LcGLp'><span id='LcGLp'><b id='LcGLp'><form id='LcGLp'><ins id='LcGLp'></ins><ul id='LcGLp'></ul><sub id='LcGLp'></sub></form><legend id='LcGLp'></legend><bdo id='LcGLp'><pre id='LcGLp'><center id='LcGLp'></center></pre></bdo></b><th id='LcGLp'></th></span></q></dt></tr></i><div id='LcGLp'><tfoot id='LcGLp'></tfoot><dl id='LcGLp'><fieldset id='LcGLp'></fieldset></dl></div>
      <legend id='LcGLp'><style id='LcGLp'><dir id='LcGLp'><q id='LcGLp'></q></dir></style></legend>
        <bdo id='LcGLp'></bdo><ul id='LcGLp'></ul>
      1. PreviewKeyDown for Windows Store App ListBox

        时间:2023-10-07
            <legend id='Ht0Nj'><style id='Ht0Nj'><dir id='Ht0Nj'><q id='Ht0Nj'></q></dir></style></legend>
          1. <i id='Ht0Nj'><tr id='Ht0Nj'><dt id='Ht0Nj'><q id='Ht0Nj'><span id='Ht0Nj'><b id='Ht0Nj'><form id='Ht0Nj'><ins id='Ht0Nj'></ins><ul id='Ht0Nj'></ul><sub id='Ht0Nj'></sub></form><legend id='Ht0Nj'></legend><bdo id='Ht0Nj'><pre id='Ht0Nj'><center id='Ht0Nj'></center></pre></bdo></b><th id='Ht0Nj'></th></span></q></dt></tr></i><div id='Ht0Nj'><tfoot id='Ht0Nj'></tfoot><dl id='Ht0Nj'><fieldset id='Ht0Nj'></fieldset></dl></div>
              <tbody id='Ht0Nj'></tbody>

              <small id='Ht0Nj'></small><noframes id='Ht0Nj'>

              <tfoot id='Ht0Nj'></tfoot>

                <bdo id='Ht0Nj'></bdo><ul id='Ht0Nj'></ul>

                  本文介绍了PreviewKeyDown for Windows Store App ListBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  对于 Windows 应用商店应用,是否有与 PreviewKeyDown 等效的方法?不可用.

                  Is there an equivalent to the PreviewKeyDown for a Windows Store App? It isn't available.

                  我的问题与 此处描述:

                  我有一个 ListBox,上面有一个 TextBox.我想使用箭头键从 ListBox 导航到 TextBox.目的是如果 ListBox 中的第一项被选中,并且用户向上键,TextBox 将获得焦点.

                  I have a ListBox with a TextBox above it. I would like to use the arrow keys to navigate from the ListBox to the TextBox. The intention is that if the first item in the ListBox is selected, and the user keys up, the TextBox will get focus.

                  推荐答案

                  啊,棘手.处理关键事件并不是很明显.这就是你想要的:

                  Ah, tricky. Handling key events isn't super-obvious. Here's what you want:

                  public MainPage()
                  {
                      this.InitializeComponent();
                      Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += (s, args) =>
                      {
                          if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown 
                              || args.EventType == CoreAcceleratorKeyEventType.KeyDown)
                              && (args.VirtualKey == VirtualKey.Up))
                          {
                              MoveUp();
                          }
                          else if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown 
                              || args.EventType == CoreAcceleratorKeyEventType.KeyDown)
                              && (args.VirtualKey == VirtualKey.Down))
                          {
                              MoveDown();
                          }
                      };
                  }
                  
                  private void MoveUp()
                  {
                      // this part is up to you
                      throw new NotImplementedException();
                  }
                  
                  private void MoveDown()
                  {
                      // this part is up to you
                      throw new NotImplementedException();
                  }
                  

                  祝你好运!

                  这篇关于PreviewKeyDown for Windows Store App ListBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在特定情况下自动滚动列表框 下一篇:C# 搜索列表框

                  相关文章

                    1. <i id='AMZcH'><tr id='AMZcH'><dt id='AMZcH'><q id='AMZcH'><span id='AMZcH'><b id='AMZcH'><form id='AMZcH'><ins id='AMZcH'></ins><ul id='AMZcH'></ul><sub id='AMZcH'></sub></form><legend id='AMZcH'></legend><bdo id='AMZcH'><pre id='AMZcH'><center id='AMZcH'></center></pre></bdo></b><th id='AMZcH'></th></span></q></dt></tr></i><div id='AMZcH'><tfoot id='AMZcH'></tfoot><dl id='AMZcH'><fieldset id='AMZcH'></fieldset></dl></div>
                    2. <legend id='AMZcH'><style id='AMZcH'><dir id='AMZcH'><q id='AMZcH'></q></dir></style></legend>

                      <small id='AMZcH'></small><noframes id='AMZcH'>

                        <bdo id='AMZcH'></bdo><ul id='AMZcH'></ul>
                      <tfoot id='AMZcH'></tfoot>