public PropertyGrid() { this.DataContext = this; PreviewMouseDown += new MouseButtonEventHandler(PropertyGrid_PreviewMouseDown); PreviewKeyDown += new KeyEventHandler(PropertyGrid_PreviewKeyDown); PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(PropertyGrid_PreviewFocusChanged); }
public EditableTextBox() : base() { //Background = ViewToolkitResources.TransparentBrush; TextAlignment = System.Windows.TextAlignment.Left; BorderThickness = new Thickness(0.0); Padding = new Thickness(5, 0, 5, 0); IsReadOnly = true; Focusable = false; IsTabStop = false; IsHitTestVisible = true; Cursor = Cursors.Arrow; Margin = ViewToolkitResources.Thickness0; KeyDown += ClassTextBox_KeyDown; KeyUp += EditableTextBox_KeyUp; MouseEnter += ClassTextBox_MouseEnter; MouseLeave += ClassTextBox_MouseLeave; LostMouseCapture += EditableTextBox_LostMouseCapture; LostFocus += ClassTextBox_LostFocus; FontFamily = new FontFamily("Trebuchet MS"); #if SILVERLIGHT #else LostKeyboardFocus += new KeyboardFocusChangedEventHandler(ClassTextBox_LostKeyboardFocus); FocusVisualStyle = null; #endif Background = ViewToolkitResources.TransparentBrush; //ResetContextMenu(); }
public DoubleTextBox() { CommandBinding CutCommandBinding = new CommandBinding(ApplicationCommands.Cut); CutCommandBinding.CanExecute += new CanExecuteRoutedEventHandler(CutCommandBinding_CanExecute); CutCommandBinding.Executed += new ExecutedRoutedEventHandler(CutCommandBinding_Executed); CommandBinding CopyCommandBinding = new CommandBinding(ApplicationCommands.Copy); CopyCommandBinding.Executed += new ExecutedRoutedEventHandler(CopyCommandBinding_Executed); CopyCommandBinding.CanExecute += new CanExecuteRoutedEventHandler(CopyCommandBinding_CanExecute); CommandBinding PasteCommandBinding = new CommandBinding(ApplicationCommands.Paste); PasteCommandBinding.Executed += new ExecutedRoutedEventHandler(PasteCommandBinding_Executed); PasteCommandBinding.CanExecute += new CanExecuteRoutedEventHandler(PasteCommandBinding_CanExecute); CommandBindings.Add(CutCommandBinding); CommandBindings.Add(CopyCommandBinding); CommandBindings.Add(PasteCommandBinding); TextChanged += new TextChangedEventHandler(DoubleTextBox_TextChanged); PreviewKeyDown += new KeyEventHandler(DoubleTextBox_PreviewKeyDown); PreviewTextInput += new TextCompositionEventHandler(DoubleTextBox_PreviewTextInput); MouseDoubleClick += new MouseButtonEventHandler(DoubleTextBox_MouseDoubleClick); LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DoubleTextBox_LostKeyboardFocus); OnNewDependencyPropertyChanged(); }
public MainWindow() { InitializeComponent(); Topmost = true; LostKeyboardFocus += new KeyboardFocusChangedEventHandler(lostKeyboardFocus); Window window = Window.GetWindow(this); var wih = new WindowInteropHelper(window); IntPtr hWnd = wih.Handle; brightnessControl = new BrightnessControl(hWnd); InitializeSliders(brightnessControl.GetMonitors()); SourceChord.FluentWPF.ResourceDictionaryEx.GlobalTheme = SourceChord.FluentWPF.ElementTheme.Dark; var w = System.Windows.SystemParameters.PrimaryScreenWidth; var h = System.Windows.SystemParameters.PrimaryScreenHeight; var taskBarHeight = h - System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; Top = h - HEIGHT - taskBarHeight; Left = w - WIDTH; var tray = new Tray(this); Hide(); }
public EnterTextbox() : base() { GotKeyboardFocus += new KeyboardFocusChangedEventHandler(EnterTextbox_GotKeyboardFocus); PreviewKeyDown += new KeyEventHandler(EnterTextBox_PreviewKeyDown); Foreground = new SolidColorBrush(Color.FromRgb(66, 66, 66)); }
public EditorPresenter() { IsKeyboardFocusWithinChanged += new DependencyPropertyChangedEventHandler(OnEditorIsKeyboardFocusWithinChanged); LostKeyboardFocus += new KeyboardFocusChangedEventHandler(OnEditorLostKeyboardFocus); LayoutUpdated += new EventHandler(OnEditorLayoutUpdated); KeyDown += new KeyEventHandler(OnEditorKeyDown); FocusVisualStyle = null; IsTabStop = false; }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { KeyboardFocusChangedEventHandler handler_ = (KeyboardFocusChangedEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new KeyboardFocusChangedEventArgs(args, false)); } }
private void OnFocusElementChangedEvent(IInputElement oldFocus, IInputElement newFocus) { KeyboardFocusChangedEventHandler handler = this.KeyboardFocusChanged; if (handler != null) { handler(this, new KeyboardFocusChangedEventArgs( Keyboard.PrimaryDevice, 0, oldFocus, newFocus)); } }
public DatePartTextBox() { GotKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePartTextBox_GotKeyboardFocus); PreviewMouseLeftButtonDown += new MouseButtonEventHandler(DatePartTextBox_PreviewMouseLeftButtonDown); MouseWheel += new MouseWheelEventHandler(DatePartTextBox_MouseWheel); KeyUp += new KeyEventHandler(DatePartTextBox_KeyUp); IsReadOnlyCaretVisible = false; //IsReadOnly = true; }
public static void AddPreviewGotKeyboardFocusHandler (DependencyObject element, KeyboardFocusChangedEventHandler handler) { if (element == null) throw new ArgumentNullException ("element"); if (handler == null) throw new ArgumentNullException ("handler"); if (element is UIElement) ((UIElement)element).AddHandler (PreviewGotKeyboardFocusEvent, handler); else if (element is ContentElement) ((ContentElement)element).AddHandler (PreviewGotKeyboardFocusEvent, handler); else throw new NotSupportedException (); }
static AttachEventHandlerAction() { // // Initialize event handlers. // eventHandlers[typeof(EventHandler)] = new EventHandler(OnGenericEvent); eventHandlers[typeof(RoutedEventHandler)] = new RoutedEventHandler(OnRoutedEvent); eventHandlers[typeof(KeyEventHandler)] = new KeyEventHandler(OnKeyEvent); eventHandlers[typeof(KeyboardFocusChangedEventHandler)] = new KeyboardFocusChangedEventHandler(OnFocusEvent); eventHandlers[typeof(TextCompositionEventHandler)] = new TextCompositionEventHandler(OnTextCompositionEvent); eventHandlers[typeof(MouseEventHandler)] = new MouseEventHandler(OnMouseEvent); eventHandlers[typeof(MouseButtonEventHandler)] = new MouseButtonEventHandler(OnMouseButtonEvent); eventHandlers[typeof(MouseButtonEventHandler)] = new MouseButtonEventHandler(OnMouseDoubleClickEvent); eventHandlers[typeof(MouseWheelEventHandler)] = new MouseWheelEventHandler(OnMouseWheelEvent); eventHandlers[typeof(DragEventHandler)] = new DragEventHandler(OnDragEvent); eventHandlers[typeof(GiveFeedbackEventHandler)] = new GiveFeedbackEventHandler(OnFeedbackEvent); eventHandlers[typeof(QueryCursorEventHandler)] = new QueryCursorEventHandler(OnQueryCursorEvent); eventHandlers[typeof(ExecutedRoutedEventHandler)] = new ExecutedRoutedEventHandler(OnExecutedEvent); eventHandlers[typeof(CanExecuteRoutedEventHandler)] = new CanExecuteRoutedEventHandler(OnCanExecuteEvent); eventHandlers[typeof(DependencyPropertyChangedEventHandler)] = new DependencyPropertyChangedEventHandler(OnPropertyChangedEvent); // // Initialize routed event static method list. // staticMethods = new List <MethodInfo>(); Type[] types = new Type[] { typeof(Mouse), typeof(Keyboard), typeof(CommandManager) }; foreach (Type type in types) { MethodInfo[] methodInfos = type.GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo methodInfo in methodInfos) { if (methodInfo.Name.EndsWith("Handler", StringComparison.InvariantCulture) && (methodInfo.Name.StartsWith("Add", StringComparison.InvariantCulture) || methodInfo.Name.StartsWith("Remove", StringComparison.InvariantCulture))) { staticMethods.Add(methodInfo); } } } }
// Token: 0x0600427F RID: 17023 RVA: 0x00130B8C File Offset: 0x0012ED8C private static void OnIsDefaultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Button button = d as Button; KeyboardFocusChangedEventHandler keyboardFocusChangedEventHandler = Button.FocusChangedEventHandlerField.GetValue(button); if (keyboardFocusChangedEventHandler == null) { keyboardFocusChangedEventHandler = new KeyboardFocusChangedEventHandler(button.OnFocusChanged); Button.FocusChangedEventHandlerField.SetValue(button, keyboardFocusChangedEventHandler); } if ((bool)e.NewValue) { AccessKeyManager.Register("\r", button); KeyboardNavigation.Current.FocusChanged += keyboardFocusChangedEventHandler; button.UpdateIsDefaulted(Keyboard.FocusedElement); return; } AccessKeyManager.Unregister("\r", button); KeyboardNavigation.Current.FocusChanged -= keyboardFocusChangedEventHandler; button.UpdateIsDefaulted(null); }
public RichTextBoxToolBar() { InitializeComponent(); this._focusedRichTextBoxTracker = new KeyboardFocusTrackingElement<RichTextBox>( this, true, new FrameworkElement[] {this}); this.EditorSelectionChangedEventHandler = delegate(Object sender, RoutedEventArgs e) { this.UpdateToolItems(); }; this.BindingElementFocusChangedEventHandler = delegate(Object sender, KeyboardFocusChangedEventArgs e) { this.DoBindingElementFocusChanged( e.OldFocus as RichTextBox, e.NewFocus as RichTextBox); }; }
public EditableTextBox() : base() { Background = System.Windows.Media.Brushes.Transparent; TextAlignment = System.Windows.TextAlignment.Left; BorderThickness = new System.Windows.Thickness(0.0); IsReadOnly = true; Focusable = false; IsTabStop = false; IsHitTestVisible = true; Cursor = System.Windows.Input.Cursors.Arrow; Margin = new System.Windows.Thickness(5, 0, 5, 0); KeyDown += new System.Windows.Input.KeyEventHandler(ClassTextBox_KeyDown); KeyUp += new KeyEventHandler(EditableTextBox_KeyUp); LostFocus += new System.Windows.RoutedEventHandler(ClassTextBox_LostFocus); LostKeyboardFocus += new KeyboardFocusChangedEventHandler(ClassTextBox_LostKeyboardFocus); MouseEnter += new MouseEventHandler(ClassTextBox_MouseEnter); MouseLeave += new MouseEventHandler(ClassTextBox_MouseLeave); ContextMenuOpening += new ContextMenuEventHandler(ClassTextBox_ContextMenuOpening); ContextMenuClosing += new ContextMenuEventHandler(ClassTextBox_ContextMenuClosing); FocusVisualStyle = null; ResetContextMenu(); }
private static void OnIsDefaultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Button b = d as Button; KeyboardFocusChangedEventHandler focusChangedEventHandler = FocusChangedEventHandlerField.GetValue(b); if (focusChangedEventHandler == null) { focusChangedEventHandler = new KeyboardFocusChangedEventHandler(b.OnFocusChanged); FocusChangedEventHandlerField.SetValue(b, focusChangedEventHandler); } if ((bool) e.NewValue) { AccessKeyManager.Register("\x000D", b); KeyboardNavigation.Current.FocusChanged += focusChangedEventHandler; b.UpdateIsDefaulted(Keyboard.FocusedElement); } else { AccessKeyManager.Unregister("\x000D", b); KeyboardNavigation.Current.FocusChanged -= focusChangedEventHandler; b.UpdateIsDefaulted(null); } }
private static void OnIsDefaultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Button b = d as Button; KeyboardFocusChangedEventHandler focusChangedEventHandler = FocusChangedEventHandlerField.GetValue(b); if (focusChangedEventHandler == null) { focusChangedEventHandler = new KeyboardFocusChangedEventHandler(b.OnFocusChanged); FocusChangedEventHandlerField.SetValue(b, focusChangedEventHandler); } if ((bool)e.NewValue) { AccessKeyManager.Register("\x000D", b); KeyboardNavigation.Current.FocusChanged += focusChangedEventHandler; b.UpdateIsDefaulted(Keyboard.FocusedElement); } else { AccessKeyManager.Unregister("\x000D", b); KeyboardNavigation.Current.FocusChanged -= focusChangedEventHandler; b.UpdateIsDefaulted(null); } }
public static void AddLostKeyboardFocusHandler(DependencyObject element, KeyboardFocusChangedEventHandler handler) { if (element == null) { throw new ArgumentNullException("element"); } if (handler == null) { throw new ArgumentNullException("handler"); } if (element is UIElement) { ((UIElement)element).AddHandler(LostKeyboardFocusEvent, handler); } else if (element is ContentElement) { ((ContentElement)element).AddHandler(LostKeyboardFocusEvent, handler); } else { throw new NotSupportedException(); } }
/// <summary> /// Removes a handler for the LostKeyboardFocus attached event /// </summary> /// <param name="element">UIElement or ContentElement that removedto this event</param> /// <param name="handler">Event Handler to be removed</param> public static void RemoveLostKeyboardFocusHandler(DependencyObject element, KeyboardFocusChangedEventHandler handler) { UIElement.RemoveHandler(element, LostKeyboardFocusEvent, handler); }
/// <summary> /// Adds a handler for the PreviewLostKeyboardFocus attached event /// </summary> /// <param name="element">UIElement or ContentElement that listens to this event</param> /// <param name="handler">Event Handler to be added</param> public static void AddPreviewLostKeyboardFocusHandler(DependencyObject element, KeyboardFocusChangedEventHandler handler) { UIElement.AddHandler(element, PreviewLostKeyboardFocusEvent, handler); }
public static void AddPreviewLostKeyboardFocusHandler(System.Windows.DependencyObject element, KeyboardFocusChangedEventHandler handler) { }
public static void RemoveGotKeyboardFocusHandler(System.Windows.DependencyObject element, KeyboardFocusChangedEventHandler handler) { }
/// <summary> /// The mechanism used to call the type-specific handler on the /// target. /// </summary> /// <param name="genericHandler"> /// The generic handler to call in a type-specific way. /// </param> /// <param name="genericTarget"> /// The target to call the handler on. /// </param> protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { KeyboardFocusChangedEventHandler handler = (KeyboardFocusChangedEventHandler)genericHandler; handler(genericTarget, this); }
public Settings() { InitializeComponent(); Action <object> FacilityDepartmentUpdateSource = new Action <object>((object sender) => { try { Action <ComboBox, System.String, System.Collections.Specialized.StringCollection> action = new Action <ComboBox, System.String, System.Collections.Specialized.StringCollection>((ComboBox comboBox, System.String param, System.Collections.Specialized.StringCollection collection) => { param = comboBox.Text; if (!collection.Contains(comboBox.Text) && comboBox.Text != System.String.Empty) { collection.Add(comboBox.Text); comboBox.ItemsSource = null; comboBox.ItemsSource = collection; } Properties.Settings.Default.Save(); }); if (sender == this.FacilityText) { action(this.FacilityText, Properties.Settings.Default.Facility, Properties.Settings.Default.FacilitiesList); } if (sender == this.DepartmentText) { action(this.DepartmentText, Properties.Settings.Default.Department, Properties.Settings.Default.DepartmentsList); } } catch (Exception ex) { MessageBox.Show(messageBoxText: ex.Message + "\n" + ex.StackTrace, "На жаль не вдалося зберегти ваші налаштування", MessageBoxButton.OK, MessageBoxImage.Error); if (sender == this.FacilityText) { this.FacilityText.Text = Properties.Settings.Default.Facility; } if (sender == this.DepartmentText) { this.DepartmentText.Text = Properties.Settings.Default.Department; } } }); KeyEventHandler FacilityDepartmentKeyUp = new KeyEventHandler((object sender, KeyEventArgs args) => { switch (args.Key) { case Key.Enter: FacilityDepartmentUpdateSource(sender); break; case Key.Escape: Action <ComboBox, System.String> action = new Action <ComboBox, string>((ComboBox comboBox, System.String param) => comboBox.Text = param); if (sender == this.FacilityText) { action((ComboBox)sender, Properties.Settings.Default.Facility); } if (sender == this.DepartmentText) { action((ComboBox)sender, Properties.Settings.Default.Department); } break; } if (args.Key == Key.Enter || args.Key == Key.Escape) { UIElement element = Keyboard.FocusedElement as UIElement; element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); } }); this.FacilityText.KeyUp += FacilityDepartmentKeyUp; this.DepartmentText.KeyUp += FacilityDepartmentKeyUp; KeyboardFocusChangedEventHandler FacilityDepartmentLostKeyboardFocus = new KeyboardFocusChangedEventHandler((object sender, KeyboardFocusChangedEventArgs args) => FacilityDepartmentUpdateSource(sender)); //this.FacilityText.LostKeyboardFocus += FacilityDepartmentLostKeyboardFocus; //this.DepartmentText.LostKeyboardFocus += FacilityDepartmentLostKeyboardFocus; RoutedEventHandler delButs = new RoutedEventHandler((object sender, RoutedEventArgs args) => { Func <string> facultyOrDepartment = new Func <string>(() => { return ((sender == this.DeleteFacilityBut ? "факультету" : System.String.Empty) + (sender == this.DeleteDepartmentBut ? "кафедри" : System.String.Empty)); }); try { if (MessageBox.Show("Увага назву" + facultyOrDepartment() + " буде видалено.\nВи дійсно бажаєте її видалити?", "Видалення" + facultyOrDepartment(), MessageBoxButton.YesNo ) == MessageBoxResult.No) { return; } Action <ComboBox, System.Collections.Specialized.StringCollection> action = new Action <ComboBox, System.Collections.Specialized.StringCollection>((ComboBox comboBox, System.Collections.Specialized.StringCollection collection) => { if (collection.Contains(comboBox.Text)) { collection.Remove(comboBox.Text); } comboBox.Text = System.String.Empty; comboBox.ItemsSource = null; comboBox.ItemsSource = collection; Properties.Settings.Default.Save(); }); if (sender == this.DeleteFacilityBut) { action(this.FacilityText, Properties.Settings.Default.FacilitiesList); } if (sender == this.DeleteDepartmentBut) { action(this.DepartmentText, Properties.Settings.Default.DepartmentsList); } } catch (Exception ex) { MessageBox.Show(messageBoxText: ex.Message + "\n" + ex.StackTrace, "На жаль не вдалося видалити назву " + facultyOrDepartment(), MessageBoxButton.OK, MessageBoxImage.Error); } }); this.DeleteDepartmentBut.Click += delButs; this.DeleteFacilityBut.Click += delButs; this.RestoreDBBut.Click += new RoutedEventHandler((object sender, RoutedEventArgs args) => this.RestoreDB()); }
internal PopupControlService() { InputManager.Current.PostProcessInput += new ProcessInputEventHandler(OnPostProcessInput); _focusChangedEventHandler = new KeyboardFocusChangedEventHandler(OnFocusChanged); }