UIElement.KeyboardAcceleratorPlacementTarget Property

Definition

Gets or sets a value that indicates the control tooltip that displays the accelerator key combination.

C#
public DependencyObject KeyboardAcceleratorPlacementTarget { get; set; }

Property Value

The control tooltip that displays the accelerator key combination.

Examples

XAML
<Grid x:Name="Container">

    <Button Content="Click" 
        ToolTipService.ToolTip="Tooltip"
        ToolTipService.PlacementTarget="{x:Bind Container}" 
        KeyboardAcceleratorPlacementTarget="{x:Bind Container}">
        <Button.KeyboardAccelerators>
            <KeyboardAccelerator Key="S" Modifiers="Control"/>
        </Button.KeyboardAccelerators>
    </Button>

</Grid>

In some cases, you might need to present a tooltip relative to another element (typically a container object).

Here, we show how to use the KeyboardAcceleratorPlacementTarget property to display the keyboard accelerator key combination for a Save button with the Grid container instead of the button.

XAML
<Grid x:Name="Container">

  <Button Content="Save" Click="OnSave">
    <Button.KeyboardAccelerators>
      <KeyboardAccelerator  Key="S" Modifiers="Control" 
        KeyboardAcceleratorPlacementTarget="{x:Bind Container}"/>
    </Button.KeyboardAccelerators>
  </Button>

</Grid>

Remarks

Use the KeyboardAcceleratorPlacementMode property to specify whether the control tooltip displays the key combination for its associated keyboard accelerator.

Applies to

Produkt Wersje
Windows App SDK 0.8, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6

See also