Esempio n. 1
0
        private void UserCommand_OnPreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Down || MatchedItems.Items.Count <= 0)
            {
                return;
            }

            MatchedItems.Focus();
            MatchedItems.SelectedIndex = 0;

            MatchedItems.UpdateLayout();
            var matchedItem = (ListBoxItem)MatchedItems.ItemContainerGenerator.ContainerFromItem(MatchedItems.SelectedItem);

            matchedItem.Focus();
        }
Esempio n. 2
0
        private void MatchedItems_OnPreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Down)
            {
//                (DataContext as TestViewModel).DoCommand(e.Key.);
                return;
            }
            if (e.Key != Key.Down || MatchedItems.Items.Count <= 0)
            {
                return;
            }

            MatchedItems.Focus();
            MatchedItems.SelectedIndex = 0;

            MatchedItems.UpdateLayout();
            var matchedItem = (ListBoxItem)MatchedItems.ItemContainerGenerator.ContainerFromItem(MatchedItems.SelectedItem);

            matchedItem.Focus();
        }