private static void OnIsAccessKeyScopeChanged(FrameworkElement element, bool oldValue, bool newValue) { if (newValue) { AccessKeyManager.AddAccessKeyPressedHandler(element, HandleScopedElementAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(element, HandleScopedElementAccessKeyPressed); } }
/// <summary> /// Called when the <see cref="P:DigitalRune.Window.AccessKeyScope.IsEnabled"/> property /// changed. /// </summary> /// <param name="dependencyObject">The dependency object.</param> /// <param name="eventArgs"> /// The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data. /// </param> private static void OnIsEnabledChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { if ((bool)eventArgs.NewValue) { AccessKeyManager.AddAccessKeyPressedHandler(dependencyObject, OnAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(dependencyObject, OnAccessKeyPressed); } }
protected virtual void OnIsDefaultChanged(bool oldValue, bool newValue) { if (newValue) { AccessKeyManager.Register("\r", this); } else { AccessKeyManager.Unregister("\r", this); } }
private static void HandleIsAccessKeyScopePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue.Equals(true)) { AccessKeyManager.AddAccessKeyPressedHandler(d, HandleScopedElementAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(d, HandleScopedElementAccessKeyPressed); } }
private void QueryTextBox_OnPreviewKeyDown(object sender, KeyEventArgs e) { // Disable new lines when pressing enter without shift if (e.Key == Key.Enter && e.KeyboardDevice.Modifiers != ModifierKeys.Shift) { e.Handled = true; // We handle the event here so we have to directly "press" the default button AccessKeyManager.ProcessKey(null, "\x000D", false); } }
/// override protected string GetAccessKeyCore() { string result = AutomationProperties.GetAccessKey(_owner); if (string.IsNullOrEmpty(result)) { return(AccessKeyManager.InternalGetAccessKeyCharacter(_owner)); } return(string.Empty); }
// Token: 0x06004283 RID: 17027 RVA: 0x00130C64 File Offset: 0x0012EE64 private static void OnIsCancelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Button element = d as Button; if ((bool)e.NewValue) { AccessKeyManager.Register("\u001b", element); return; } AccessKeyManager.Unregister("\u001b", element); }
public Instance(Window window) { Ensure.NotNull(window, "window"); this.window = window; AccessKeyManager.AddAccessKeyPressedHandler(window, OnAccessKeyPressed); window.PreviewKeyDown += OnPreviewKeyDown; window.PreviewKeyUp += OnPreviewKeyUp; window.LostFocus += OnLostFocus; window.Deactivated += OnDeactivated; }
public Artboard(IViewObjectFactory viewObjectFactory, ViewExceptionCallback viewExceptionCallback) { this.ViewObjectFactory = viewObjectFactory; this.contentBorder = new ArtboardBorder(viewExceptionCallback); this.contentBorder.BorderBrush = (Brush)Brushes.Black; this.contentBorder.MinWidth = 20.0; this.contentBorder.MinHeight = 20.0; this.contentBorder.IsHitTestVisible = false; TextOptions.SetTextFormattingMode((DependencyObject)this.contentBorder, TextFormattingMode.Ideal); this.snapToGridRenderer = new SnapToGridRenderer(this); this.snapToGridRenderer.IsHitTestVisible = false; this.overlayLayer = new OverlayLayer(); this.overlayLayer.IsHitTestVisible = false; this.adornerLayer = new AdornerLayer(); this.adornerLayer.IsHitTestVisible = false; this.adornerLayer.IsVisibleChanged += (DependencyPropertyChangedEventHandler)((s, e) => this.UpdateExtensibleAdornersVisibility()); this.feedbackLayer = new FeedbackLayer(); this.feedbackLayer.IsHitTestVisible = false; this.annotationLayer = new AnnotationLayer(); this.annotationLayer.IsHitTestVisible = true; this.extraLayersCanvas = new Canvas(); this.extraLayersCanvas.IsHitTestVisible = false; this.liveControlLayer = new Canvas(); this.liveControlLayer.Resources.Add((object)typeof(TextBox), (object)new Style(typeof(TextBox), new TextBox().Style)); this.liveControlLayer.Resources.Add((object)typeof(RichTextBox), (object)new Style(typeof(RichTextBox), new RichTextBox().Style)); this.resourcesHost = new Canvas(); this.resourcesHost.IsHitTestVisible = false; this.resourcesHost.Children.Add((UIElement)this.contentBorder); this.resourcesHost.Children.Add((UIElement)this.overlayLayer); this.designerView = (DesignerView) new Artboard.BlendDesignerView(); this.designerView.Child = (UIElement)this.resourcesHost; this.canvas = new Canvas(); this.canvas.Children.Add((UIElement)this.designerView); this.canvas.Children.Add((UIElement)this.liveControlLayer); this.canvas.Children.Add((UIElement)this.extraLayersCanvas); this.canvas.Children.Add((UIElement)this.snapToGridRenderer); this.canvas.Children.Add((UIElement)this.adornerLayer); this.canvas.Children.Add((UIElement)this.feedbackLayer); this.canvas.Children.Add((UIElement)this.annotationLayer); this.childrenVisuals = new VisualCollection((Visual)this); this.childrenVisuals.Add((Visual)this.canvas); this.adornerService = new AdornerService(this); this.SetValue(TabControl.TabStripPlacementProperty, (object)Dock.Top); this.InheritanceBehavior = InheritanceBehavior.SkipToThemeNow; this.AllowDrop = true; this.contentBorder.AllowDrop = false; AccessKeyManager.AddAccessKeyPressedHandler((DependencyObject)this.contentBorder, new AccessKeyPressedEventHandler(this.Content_AccessKeyPressed)); AccessKeyManager.AddAccessKeyPressedHandler((DependencyObject)this.overlayLayer, new AccessKeyPressedEventHandler(this.Content_AccessKeyPressed)); this.contentBorder.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Content_PreviewGotKeyboardFocus); this.overlayLayer.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Content_PreviewGotKeyboardFocus); this.SetTextDefaults(); }
private static void OnIsCancelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Button b = d as Button; if ((bool)e.NewValue) { AccessKeyManager.Register("\x001B", b); } else { AccessKeyManager.Unregister("\x001B", b); } }
public Label() { IsTabStop = false; AccessKeyManager.AddAccessKeyPressedHandler(this, delegate(object sender, AccessKeyPressedEventArgs e) { UIElement target = Target; if (target != null) { target.Focus(); } }); }
public EditSelector() { InitializeComponent(); // initialize member variables // used in Split delimiters = new char[] { DEFAULT_DELIMITER }; // used to recreate the delimited text (offset by space for readability) delimiterString = DEFAULT_DELIMITER + " "; // register default access key AccessKeyManager.Register(DEFAULT_PLUS_ACCESSKEY, PlusButton); // create select window instance selectWindow = new SelectWindow(); }
private void RegisterAccessKey() { if (_currentlyRegistered != null) { AccessKeyManager.Unregister(_currentlyRegistered, this); _currentlyRegistered = null; } string key = _accessKey.Text; if (!string.IsNullOrEmpty(key)) { AccessKeyManager.Register(key, this); _currentlyRegistered = key; } }
// Token: 0x06004214 RID: 16916 RVA: 0x0012E4D4 File Offset: 0x0012C6D4 private void RegisterAccessKey() { if (this._currentlyRegistered != null) { AccessKeyManager.Unregister(this._currentlyRegistered, this); this._currentlyRegistered = null; } string text = this._accessKey.Text; if (!string.IsNullOrEmpty(text)) { AccessKeyManager.Register(text, this); this._currentlyRegistered = text; } }
private void DisonnectFromPresentationSource() { if (_rootInputElement != null) { foreach (string registeredKey in _renameAccessKeys) { AccessKeyManager.Unregister(registeredKey, _rootInputElement); } AccessKeyManager.RemoveAccessKeyPressedHandler(_rootDependencyObject, OnAccessKeyPressed); } _presentationSource = null; _rootDependencyObject = null; _rootInputElement = null; }
public HomeOwersController( CommunityManager communityManager, AccessKeyManager accessKeyManager, HomeOwerManager homeOwerManager, DoorManager doorManager, TenantManager tenantManager, HomeOwerUserManager homeOwerUserManager) : base(homeOwerUserManager) { _communityManager = communityManager; _accessKeyManager = accessKeyManager; _homeOwerManager = homeOwerManager; _tenantManager = tenantManager; _doorManager = doorManager; _homeOwerUserManager = homeOwerUserManager; }
public EventRecurrenceSkip(DateTime[] skip) { InitializeComponent(); if (skip != null && skip.Length > 0) { statusText.Visibility = Visibility.Collapsed; foreach (object each in skip) { listBox.Items.Add(each); } } AccessKeyManager.Register(" ", okButton); }
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d == null) { return; } if ((bool)e.NewValue) { AccessKeyManager.AddAccessKeyPressedHandler(d, HandleAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(d, HandleAccessKeyPressed); } }
public Instance(Window window) { Ensure.NotNull(window, "window"); this.window = window; AccessKeyManager.AddAccessKeyPressedHandler(window, OnAccessKeyPressed); window.PreviewKeyDown += OnPreviewKeyDown; window.PreviewKeyUp += OnPreviewKeyUp; window.LostFocus += OnLostFocus; window.Activated += OnActivated; window.Deactivated += OnDeactivated; if (!IsAccessKeyDown()) { SetIsKeyboardCues(window, false); } }
// initialize the plus button access key private static void PlusButtonAccessKeyPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { string source = e.NewValue as string; string old = e.OldValue as string; EditSelector control = sender as EditSelector; if (source == null || control == null) { return; } // set the access key for the plus button AccessKeyManager.Register(source, control.PlusButton); // unregister the old access key if present if (old != null) { AccessKeyManager.Unregister(old, control.PlusButton); } }
private void RegisterAccessKey() { if (_registeredAccessKey != null) { AccessKeyManager.Unregister(_registeredAccessKey, this); _registeredAccessKey = null; } var accessKey = GetAccessKey(); if (string.IsNullOrEmpty(accessKey)) { return; } AccessKeyManager.Register(accessKey, this); _registeredAccessKey = accessKey; }
public TaskDialog(Window Owner, string Title, string Details, MessageType MessageIcon) { InitializeComponent(); this.Owner = Owner; this.Title = Title; detailsText.Text = Details; _icon = MessageIcon; AccessKeyManager.Register(" ", okButton); if (Owner == null) { ShowAsGlobal(); } }
/// <summary> /// This is overridden to pass hot keys on to the contained user control. /// </summary> /// <param name="m">The message to pre-process</param> /// <returns>True if the message was handled, false if not</returns> /// <remarks>When a WPF user control is hosted in a docked tool window, the hot keys no longer work. /// This works around the problem by manually seeing if the control makes use of the hot key, and if /// it does, processing it here.</remarks> protected override bool PreProcessMessage(ref System.Windows.Forms.Message m) { if (m.Msg == 0x0100 /* WM_KEYDOWN */) { System.Windows.Forms.Keys keyCode = (System.Windows.Forms.Keys)m.WParam & System.Windows.Forms.Keys.KeyCode; if (keyCode == System.Windows.Forms.Keys.F1) { ApplicationCommands.Help.Execute(null, (UserControl)base.Content); return(true); } } if (m.Msg == 0x0104 /* WM_SYSKEYDOWN */) { if (Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt)) { // Cache a copy of the scope on first use if (scope == null && base.Content != null) { // Get the scope for handling hot keys. The key used here doesn't matter. We're just // getting the scope to use. AccessKeyPressedEventArgs e = new AccessKeyPressedEventArgs("X"); ((UserControl)base.Content).RaiseEvent(e); scope = e.Scope; } string key = ((char)m.WParam).ToString(); // See if the hot key is registered for the control. If so, handle it. Ignore anything // that isn't 'A' to 'Z' if (scope != null && key[0] >= 'A' && key[0] <= 'Z' && AccessKeyManager.IsKeyRegistered(scope, key)) { AccessKeyManager.ProcessKey(scope, key, false); return(true); } } } return(base.PreProcessMessage(ref m)); }
public EditRecurring(Window Owner, EditingType editType) { InitializeComponent(); this.Owner = Owner; EditType = editType; switch (EditType) { case EditingType.Delete: Title = "Delete Recurring Item"; detailsText.Text = "What do you want to delete?"; break; case EditingType.Open: break; } AccessKeyManager.Register(" ", okButton); }
public EventRecurrence(Appointment appointment) { InitializeComponent(); _appointment = appointment; // Initialize display to defaults InitializeNewDisplay(); if (_appointment.IsRepeating) { InitializeRepeatDisplay(); } Loaded += EventRecurrence_Loaded; AccessKeyManager.Register(" ", okButton); ShadowController c = new ShadowController(this); }
private void AddButton(string text, bool isDefault, bool isCancel) { Button button = new Button(); button.Width = 75; button.Height = 25; button.Margin = new Thickness(10, 0, 0, 0); button.Content = text; button.IsDefault = isDefault; button.IsCancel = isCancel; if (isDefault) { AccessKeyManager.Register(" ", button); } button.Click += button_Click; btns.Children.Add(button); }
// 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 TaskDialog(Window Owner, string Title, string Details, MessageType MessageIcon, string OKText, string CancelText) { InitializeComponent(); this.Owner = Owner; this.Title = Title; detailsText.Text = Details; _icon = MessageIcon; okButton.Content = OKText; cancelButton.Content = CancelText; cancelButton.Visibility = Visibility.Visible; AccessKeyManager.Register(" ", okButton); if (Owner == null) { ShowAsGlobal(); } }
bool System.Windows.Interop.IKeyboardInputSink.OnMnemonic(ref MSG msg, ModifierKeys modifiers) { switch (msg.message) { case 262: case 263: { string str = new string((char)((int)msg.wParam), 1); if (str == null || str.Length <= 0) { break; } IntPtr owner = (new WindowInteropHelper(this.Window)).Owner; HwndSource hwndSource = HwndSource.FromHwnd(owner); if (hwndSource == null || !AccessKeyManager.IsKeyRegistered(hwndSource, str)) { break; } AccessKeyManager.ProcessKey(hwndSource, str, false); return(true); } } return(false); }
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); } }