This documentation is archived and is not being maintained.

InputBindingCollection Class

Represents an ordered collection of InputBinding objects.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public sealed class InputBindingCollection : IList, 
	ICollection, IEnumerable
<InputBindingCollection .../>

All objects that derive from UIElement have an InputBindingCollection named InputBindings. All objects that derive from ContentElement have an InputBindingCollection named InputBindings.

However, if these collections are set in XAML, then the items in the collection must be derived classes of InputBinding rather than direct InputBinding objects. This is because InputBinding does not support a default public constructor. Therefore, the items in a InputBindingCollection that was set in XAML will typically be an InputBinding derived class that does support a default public constructor, such as KeyBinding or MouseBinding.

The following example creates a KeyGesture and associates it with a KeyBinding. The KeyBinding is added to the InputBindingCollection on a Window.

  <KeyBinding Key="B"
              Command="ApplicationCommands.Open" />
KeyGesture OpenKeyGesture = new KeyGesture(

KeyBinding OpenCmdKeybinding = new KeyBinding(



Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0