private void custNameBox_clear(UIElement sender, GettingFocusEventArgs args) { if (custNameBox.Text == "Customer Name") { custNameBox.Text = ""; } }
private void widthBox_clear(UIElement sender, GettingFocusEventArgs args) { if (widthBox.Text == "Width") { widthBox.Text = ""; } }
private void depthBox_clear(UIElement sender, GettingFocusEventArgs args) { if (depthBox.Text == "Depth") { depthBox.Text = ""; } }
private static void OnTargetUIGettingFocus(UIElement sender, GettingFocusEventArgs args) { // does not prevent if inside TargetUI focus movement. if (IsInsidePanel(args.OldFocusedElement, sender)) { return; } var orientation = GetFocusAcceptOrientation(sender); switch (orientation) { case Orientation.Vertical: if (args.Direction == FocusNavigationDirection.Right || args.Direction == FocusNavigationDirection.Left) { args.Cancel = true; } break; case Orientation.Horizontal: if (args.Direction == FocusNavigationDirection.Up || args.Direction == FocusNavigationDirection.Down) { args.Cancel = true; } break; } }
static void GettingFocus(object sender, GettingFocusEventArgs e) { if (e.NewFocusedElement is Popup) { Assert.Fail(); } }
public static void GettingFocus(UIElement sender, GettingFocusEventArgs args) { Popup popup = (Popup)sender; popup.Opacity = 0; if (popup.IsOpen) { Opened(popup, new object()); } popup.Opened -= Opened; popup.Opened += Opened; (popup.Child as FrameworkElement).SizeChanged -= RefreshCenteredPopup; (popup.Child as FrameworkElement).SizeChanged += RefreshCenteredPopup; }
private async void UserNameBox_GettingFocus(UIElement sender, GettingFocusEventArgs args) { AutoSuggestBox autoSuggestBox = sender as AutoSuggestBox; if (currentAddress == null) { autoSuggestBox.ItemsSource = null; } else { var userNames = await PasswordManager.Current.GetUserNamesAsync( currentAddress.Host, currentAddress.Port, autoSuggestBox.Text); autoSuggestBox.ItemsSource = userNames; } }
// When focus comes from outside the RadioButtons control we will put focus on the selected radio button. private void OnGettingFocus(object sender, GettingFocusEventArgs args) { var repeater = m_repeater; if (repeater != null) { var inputDevice = args.InputDevice; if (inputDevice == FocusInputDeviceKind.Keyboard) { // If focus is coming from outside the repeater, put focus on the selected item. var oldFocusedElement = args.OldFocusedElement; if (oldFocusedElement == null || repeater != VisualTreeHelper.GetParent(oldFocusedElement)) { var selectedItem = repeater.TryGetElement(m_selectedIndex); if (selectedItem != null) { var argsAsIGettingFocusEventArgs2 = args as GettingFocusEventArgs; if (argsAsIGettingFocusEventArgs2 != null) { if (args.TrySetNewFocusedElement(selectedItem)) { args.Handled = true; } } } } // Focus was already in the repeater: in On RS3+ Selection follows focus unless control is held down. else if (SharedHelpers.IsRS3OrHigher() && (Windows.UI.Xaml.Window.Current.CoreWindow.GetKeyState(VirtualKey.Control) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down) { var newFocusedElementAsUIE = args.NewFocusedElement as UIElement; if (newFocusedElementAsUIE != null) { Select(repeater.GetElementIndex(newFocusedElementAsUIE)); args.Handled = true; } } } } }
private void CBoxLotNums_GettingFocus(UIElement sender, GettingFocusEventArgs args) { SelectedLot = new LotItem(); }
private void EventImage_GettingFocus(UIElement sender, GettingFocusEventArgs args) { }
bool IGettingFocusEventArgsResolver.Handled(GettingFocusEventArgs e) => e.Handled;
/// <summary> /// Sets a value that marks the routed event as handled. A <c>true</c> value for <see cref="GettingFocusEventArgs.Handled"/> /// prevents most handlers along the event route from handling the same event again. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <param name="handled"> /// <c>true</c> to mark the routed event handled. <c>false</c> to leave the routed event unhandled, /// which permits the event to potentially route further and be acted on by other handlers. /// The default is <c>false</c>. /// </param> public static void Handled(this GettingFocusEventArgs e, bool handled) => Resolver.Handled(e, handled);
/// <summary> /// Gets the input device type from which input events are received. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <returns>The input device type.</returns> public static FocusInputDeviceKind InputDevice(this GettingFocusEventArgs e) => Resolver.InputDevice(e);
private void UserControl_GettingFocus(UIElement sender, GettingFocusEventArgs args) { UpdateTitleBarLayout(); }
void IGettingFocusEventArgsResolver.Cancel(GettingFocusEventArgs e, bool cancel) => e.Cancel = cancel;
void IGettingFocusEventArgsResolver.Handled(GettingFocusEventArgs e, bool handled) => e.Handled = handled;
/// <summary> /// Gets the input mode through which an element obtained focus. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <returns>How the element obtained focus.</returns> public static FocusState FocusState(this GettingFocusEventArgs e) => Resolver.FocusState(e);
/// <summary> /// Gets a reference to the object that raised the event. /// This is often a template part of a control rather than an element that was declared in your app UI. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <returns>The object that raised the event.</returns> public static object OriginalSource(this GettingFocusEventArgs e) => Resolver.OriginalSource(e);
FocusInputDeviceKind IGettingFocusEventArgsResolver.InputDevice(GettingFocusEventArgs e) => e.InputDevice;
Guid IGettingFocusEventArgsResolver.CorrelationId(GettingFocusEventArgs e) => e.CorrelationId;
bool IGettingFocusEventArgsResolver.TrySetNewFocusedElement(GettingFocusEventArgs e, DependencyObject element) => e.TrySetNewFocusedElement(element);
bool IGettingFocusEventArgsResolver.TryCancel(GettingFocusEventArgs e) => e.TryCancel();
static void OnGettingFocus(object sender, GettingFocusEventArgs args) { Assert.Fail("Focus should not move"); }
/// <summary> /// Gets the direction that focus moved from element to element within the app UI. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <returns>The direction of focus movement.</returns> public static FocusNavigationDirection Direction(this GettingFocusEventArgs e) => Resolver.Direction(e);
private void CarouVideo_GettingFocus(UIElement sender, GettingFocusEventArgs args) { //CarouVideo.Play(); }
/// <summary> /// Gets a value that marks the routed event as handled. A <c>true</c> value for <see cref="GettingFocusEventArgs.Handled"/> /// prevents most handlers along the event route from handling the same event again. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <returns> /// <c>true</c> to mark the routed event handled. <c>false</c> to leave the routed event unhandled, /// which permits the event to potentially route further and be acted on by other handlers. /// The default is <c>false</c>. /// </returns> public static bool Handled(this GettingFocusEventArgs e) => Resolver.Handled(e);
/// <summary> /// Gets the most recent focused object. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <returns>The most recent focused object.</returns> public static DependencyObject NewFocusedElement(this GettingFocusEventArgs e) => Resolver.NewFocusedElement(e);
bool IGettingFocusEventArgsResolver.Cancel(GettingFocusEventArgs e) => e.Cancel;
void OnGettingFocus(UIElement sender, GettingFocusEventArgs args) => focusDirection = args.Direction;
/// <summary> /// Sets the most recent focused object. /// </summary> /// <param name="e">The requested <see cref="GettingFocusEventArgs"/>.</param> /// <param name="newFocusedElement">The most recent focused object.</param> public static void NewFocusedElement(this GettingFocusEventArgs e, DependencyObject newFocusedElement) => Resolver.NewFocusedElement(e, newFocusedElement);