예제 #1
0
        private void ItemList_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Enter:
                if (e.OriginalSource is ListBoxItem)
                {
                    e.Handled    = true;
                    Popup.IsOpen = false;

                    if (QueryResult != null && ItemList.SelectedItem != null)
                    {
                        QueryResult.Execute(ItemList.SelectedItem);
                        args = new RoutedEventArgs(QueryResultSelectedEvent);
                        RaiseEvent(args);
                        SearchTextBoxControl.Clear();
                    }
                }
                break;

            case Key.Up:
            case Key.Down:
                break;

            default:
                e.Handled = true;
                break;
            }
        }
예제 #2
0
 private void CityPopupControlButton_LostFocus(object sender, RoutedEventArgs e)
 {
     if (Popup != null && !IsMouseOver)
     {
         Popup.IsOpen = false;
         SearchTextBoxControl.Clear();
     }
 }
예제 #3
0
        private void OnSearchClick(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            if (Command != null && Command.CanExecute(CommandParameter))
            {
                Command.Execute(CommandParameter);
            }

            args = new RoutedEventArgs(SearchClickEvent);
            RaiseEvent(args);
            SearchTextBoxControl.Clear();
        }
예제 #4
0
 private void CityPopupControlButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (((FrameworkElement)Popup.FindName("BackGrid")).IsMouseOver || (ItemList.IsMouseOver && ItemList.SelectedItem != null))
     {
         Popup.IsOpen = false;
         SearchTextBoxControl.Clear();
     }
     else if (Popup != null && Popup.IsOpen && !(SearchTextBoxControl.IsMouseOver || ItemList.IsMouseOver))
     {
         ;
         e.Handled = true;
     }
 }
예제 #5
0
        private void ItemList_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed && ItemList.SelectedItem != null &&
                ((ListBoxItem)ItemList.ItemContainerGenerator.ContainerFromIndex(ItemList.SelectedIndex)).IsMouseOver)
            {
                Popup.IsOpen = false;
                e.Handled    = true;

                if (QueryResult != null)
                {
                    QueryResult.Execute(ItemList.SelectedItem);
                    args = new RoutedEventArgs(QueryResultSelectedEvent);
                    RaiseEvent(args);
                    SearchTextBoxControl.Clear();
                }
            }
        }
예제 #6
0
        private void PreviewEscapeTabKeyDown(KeyEventArgs e)
        {
            Popup.IsOpen = false;
            SearchTextBoxControl.Clear();

            if (e.Key == Key.Tab)
            {
                Frame    parent = GlobalUtils.FindVisualParent <Frame>(this);
                Selector child  = GlobalUtils.FindVisualChildren <Selector>(parent).FirstOrDefault();

                if (child != null)
                {
                    parent.Focusable = true;
                    child.Focus();
                    parent.Focusable = false;
                }
            }
        }
예제 #7
0
 private void ClearButtonControl_Click(object sender, RoutedEventArgs e)
 {
     SearchTextBoxControl.Clear();
 }