KeyboardAccelerator.ScopeOwner Property

Definition

Gets or sets the scope (or target) of the keyboard accelerator.

C#
public DependencyObject ScopeOwner { get; set; }

Property Value

The scope (or target) of the keyboard accelerator. The default is null (global scope).

Examples

This example demonstrates how to create a scoped accelerator. The Ctrl+Menu+S accelerator is invoked only if the focus is on a child of MainGrid.

XAML
<Grid x:Name="MainGrid"><Button Content="Save" Click="OnSave">
        <Button.KeyboardAccelerators>
            <KeyboardAccelerator 
                Key="S"
                Modifiers="Control, Menu"
                ScopeOwner="{x:Bind MainGrid}" />
        </Button.KeyboardAccelerators>
    </Button></Grid>
<Grid x:Name="SecondaryGrid"> >
    …
    <Button Content="Edit" Click Click="OnEdit"/></Grid>

Remarks

By default, an accelerator has global scope. However, you can constrain scope using ScopeOwner or disable an accelerator completely using IsEnabled.

Applies to

Продукт Версії
Windows App SDK 0.8, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6

See also