コード例 #1
0
        private void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }

            if (popup.IsOpen)
            {
                popup.IsOpen = false;
                return;
            }

            SearchViewModel svm = DataContext as SearchViewModel;

            if (svm != null)
            {
                if (!svm.IsFound)
                {
                    return;
                }

                if (!svm.Continue())
                {
                    popup.IsOpen = true;
                }
            }
        }