Export (0) Print
Expand All

InputBindingCollection Class

Represents an ordered collection of InputBinding objects.


Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

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

The InputBindingCollection type exposes the following members.

Public methodInputBindingCollection()Initializes a new instance of the InputBindingCollection class.
Public methodInputBindingCollection(IList)Initializes a new instance of the InputBindingCollection class using the items in the specified IList.

Public propertyCountGets the number of InputBinding items in this collection.
Public propertyIsFixedSizeGets a value that indicates whether this InputBindingCollection has a fixed size.
Public propertyIsReadOnlyGets a value that indicates whether this InputBindingCollection is read-only.
Public propertyIsSynchronizedGets a value indicating whether access to this InputBindingCollection is synchronized (thread-safe).
Public propertyItemGets or sets the InputBinding at the specified index.
Public propertySyncRootGets an object that can be used to synchronize access to the InputBindingCollection.

Public methodAddAdds the specified InputBinding to this InputBindingCollection.
Public methodAddRangeAdds the items of the specified ICollection to the end of this InputBindingCollection
Public methodClearRemoves all items from this InputBindingCollection.
Public methodContainsDetermines whether the specified InputBinding is in this InputBindingCollection
Public methodCopyToCopies all of the items in the InputBindingCollection to the specified one-dimensional array, starting at the specified index of the target array.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnumeratorGets an enumerator that iterates through this InputBindingCollection.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexOfSearches for the first occurrence of the specified InputBinding in his InputBindingCollection.
Public methodInsertInserts the specified InputBinding into this InputBindingCollection at the specified index.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveRemoves the first occurrence of the specified InputBinding from this InputBindingCollection.
Public methodRemoveAtRemoves the specified InputBinding at the specified index of this InputBindingCollection.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)

Explicit interface implemetationPrivate methodICollection.CopyToInfrastructure. For a description of this member, see ICollection.CopyTo.
Explicit interface implemetationPrivate methodIList.AddInfrastructure. For a description of this member, see IList.Add.
Explicit interface implemetationPrivate methodIList.ContainsInfrastructure. For a description of this member, see IList.Contains.
Explicit interface implemetationPrivate methodIList.IndexOfInfrastructure. For a description of this member, see IList.IndexOf.
Explicit interface implemetationPrivate methodIList.InsertInfrastructure. For a description of this member, see IList.Insert.
Explicit interface implemetationPrivate propertyIList.ItemInfrastructure. For a description of this member, see IList.Item.
Explicit interface implemetationPrivate methodIList.RemoveInfrastructure. For a description of this member, see IList.Remove.

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(


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

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

Community Additions

© 2015 Microsoft