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; } }
private void CityPopupControlButton_LostFocus(object sender, RoutedEventArgs e) { if (Popup != null && !IsMouseOver) { Popup.IsOpen = false; SearchTextBoxControl.Clear(); } }
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(); }
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; } }
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(); } } }
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; } } }
private void ClearButtonControl_Click(object sender, RoutedEventArgs e) { SearchTextBoxControl.Clear(); }