Back to Devexpress

BarItem.KeyGesture Property

wpf-devexpress-dot-xpf-dot-bars-dot-baritem-7f9c55d8.md

latest3.8 KB
Original Source

BarItem.KeyGesture Property

Gets or sets a keyboard combination that can be used to invoke the current bar item’s functionality. This is a dependency property.

Namespace : DevExpress.Xpf.Bars

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public KeyGesture KeyGesture { get; set; }
vb
Public Property KeyGesture As KeyGesture

Property Value

TypeDescription
KeyGesture

A KeyGesture object.

|

Remarks

When a key combination defined by the KeyGesture property is invoked, the item’s functionality is invoked as follows:

Example

This example shows how to specify a command and custom short cut for a bar item. A command and short cut are assigned to the item via the Command and KeyGesture properties, respectively. In the example, a bar is docked to the BarContainerControl which is created manually.

xaml
<dxb:BarManager.Items>                
    <dxb:BarButtonItem Name="btnCut" 
                       Command="ApplicationCommands.Cut" 
                       KeyGesture="CTRL+1" 
                       CommandTarget="{Binding ElementName=textBox}" 
                       Content="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>
</dxb:BarManager.Items>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the KeyGesture property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-create-supertips-for-bar-items-ribbon-items-and-standard-controls-in-code-and-xaml-e2702/CS/SuperTipForRibbonFromXaml.xaml#L11

xml
<dxb:BarManager.Items>
    <dxb:BarButtonItem Name="bNew" Content="New" Glyph="new-16x16.png" LargeGlyph="new-32x32.png" KeyGesture="Ctrl+N">
        <dxb:BarButtonItem.SuperTip>

See Also

KeyGestureText

ShowKeyGesture

Command

BarItem.ItemClick

BarManager.ItemClick

PerformClick()

ShowShortcutInScreenTips

BarItem Class

BarItem Members

DevExpress.Xpf.Bars Namespace