Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

KeyboardAccelerator.ScopeOwner Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

public:
 property DependencyObject ^ ScopeOwner { DependencyObject ^ get(); void set(DependencyObject ^ value); };
DependencyObject ScopeOwner();

void ScopeOwner(DependencyObject value);
public DependencyObject ScopeOwner { get; set; }
var dependencyObject = keyboardAccelerator.scopeOwner;
keyboardAccelerator.scopeOwner = dependencyObject;
Public Property ScopeOwner As DependencyObject

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.

<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="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

See also


Feedback

Was this page helpful?