示例#1
0
        private void UserControl_AccessKeyDisplayRequested(UIElement sender, AccessKeyDisplayRequestedEventArgs args)
        {
            var tooltip = ToolTipService.GetToolTip(Button) as ToolTip;

            if (tooltip == null)
            {
                tooltip                = new ToolTip();
                tooltip.Background     = new SolidColorBrush(Windows.UI.Colors.Black);
                tooltip.Foreground     = new SolidColorBrush(Windows.UI.Colors.White);
                tooltip.Padding        = new Thickness(4, 4, 4, 4);
                tooltip.VerticalOffset = -20;
                tooltip.Placement      = PlacementMode.Bottom;
                ToolTipService.SetToolTip(sender, tooltip);
            }

            if (string.IsNullOrEmpty(args.PressedKeys))
            {
                tooltip.Content = sender.AccessKey;
            }
            else
            {
                tooltip.Content = sender.AccessKey.Remove(0, args.PressedKeys.Length);
            }

            tooltip.IsOpen = true;
        }
示例#2
0
        private void OnDisplayRequested(UIElement sender, AccessKeyDisplayRequestedEventArgs args)
        {
            var tooltip = new ToolTip
            {
                Background     = new SolidColorBrush(Colors.Black),
                Foreground     = new SolidColorBrush(Colors.White),
                Padding        = new Thickness(4),
                VerticalOffset = -20,
                Placement      = PlacementMode.Bottom,
                Content        = sender.AccessKey
            };

            ToolTipService.SetToolTip(sender, tooltip);

            tooltip.IsOpen = true;
        }
        private void OnDisplayRequested(UIElement sender, AccessKeyDisplayRequestedEventArgs args)
        {
            var tooltip = new ToolTip
            {
                Background = new SolidColorBrush(Colors.Black),
                Foreground = new SolidColorBrush(Colors.White),
                Padding = new Thickness(4),
                VerticalOffset = -20,
                Placement = PlacementMode.Bottom,
                Content = sender.AccessKey
            };

            ToolTipService.SetToolTip(sender, tooltip);

            tooltip.IsOpen = true;
        }
示例#4
0
        private void OnAccessKeyPressed(UIElement sender, AccessKeyDisplayRequestedEventArgs args)
        {
            ToolTip tooltip = ToolTipService.GetToolTip(sender) as ToolTip;

            tooltip.IsOpen = true;
        }
示例#5
0
 string IAccessKeyDisplayRequestedEventArgsResolver.PressedKeys(AccessKeyDisplayRequestedEventArgs e) => e.PressedKeys;
示例#6
0
 /// <summary>
 /// Gets the keys that were pressed to start the access key sequence.
 /// </summary>
 /// <param name="e">The requested <see cref="AccessKeyDisplayRequestedEventArgs"/>.</param>
 /// <returns>The keys that were pressed to start the access key sequence.</returns>
 public static string PressedKeys(this AccessKeyDisplayRequestedEventArgs e) => Resolver.PressedKeys(e);