InputBindingCollection InputBindingCollection InputBindingCollection InputBindingCollection Class

Definition

Represents an ordered collection of InputBinding objects.

public ref class InputBindingCollection sealed : System::Collections::IList
public sealed class InputBindingCollection : System.Collections.IList
type InputBindingCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class InputBindingCollection
Implements IList
Inheritance
InputBindingCollectionInputBindingCollectionInputBindingCollectionInputBindingCollection
Implements

Examples

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

<Window.InputBindings>
  <KeyBinding Key="B"
              Modifiers="Control" 
              Command="ApplicationCommands.Open" />
</Window.InputBindings>
KeyGesture OpenKeyGesture = new KeyGesture(
    Key.B,
    ModifierKeys.Control);

KeyBinding OpenCmdKeybinding = new KeyBinding(
    ApplicationCommands.Open,
    OpenKeyGesture);

this.InputBindings.Add(OpenCmdKeybinding);
Dim OpenKeyGesture As New KeyGesture(Key.B, ModifierKeys.Control)

Dim OpenCmdKeybinding As New KeyBinding(ApplicationCommands.Open, OpenKeyGesture)

Me.InputBindings.Add(OpenCmdKeybinding)

Remarks

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.

Constructors

InputBindingCollection() InputBindingCollection() InputBindingCollection() InputBindingCollection()

Initializes a new instance of the InputBindingCollection class.

InputBindingCollection(IList) InputBindingCollection(IList) InputBindingCollection(IList) InputBindingCollection(IList)

Initializes a new instance of the InputBindingCollection class using the items in the specified IList.

Properties

Count Count Count Count

Gets the number of InputBinding items in this collection.

IsFixedSize IsFixedSize IsFixedSize IsFixedSize

Gets a value that indicates whether this InputBindingCollection has a fixed size.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets a value that indicates whether this InputBindingCollection is read-only.

IsSynchronized IsSynchronized IsSynchronized IsSynchronized

Gets a value indicating whether access to this InputBindingCollection is synchronized (thread-safe).

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets or sets the InputBinding at the specified index.

SyncRoot SyncRoot SyncRoot SyncRoot

Gets an object that can be used to synchronize access to the InputBindingCollection.

Methods

Add(InputBinding) Add(InputBinding) Add(InputBinding) Add(InputBinding)

Adds the specified InputBinding to this InputBindingCollection.

AddRange(ICollection) AddRange(ICollection) AddRange(ICollection) AddRange(ICollection)

Adds the items of the specified ICollection to the end of this InputBindingCollection

Clear() Clear() Clear() Clear()

Removes all items from this InputBindingCollection.

Contains(InputBinding) Contains(InputBinding) Contains(InputBinding) Contains(InputBinding)

Determines whether the specified InputBinding is in this InputBindingCollection

CopyTo(InputBinding[], Int32) CopyTo(InputBinding[], Int32) CopyTo(InputBinding[], Int32) CopyTo(InputBinding[], Int32)

Copies all of the items in the InputBindingCollection to the specified one-dimensional array, starting at the specified index of the target array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Gets an enumerator that iterates through this InputBindingCollection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(InputBinding) IndexOf(InputBinding) IndexOf(InputBinding) IndexOf(InputBinding)

Searches for the first occurrence of the specified InputBinding in his InputBindingCollection.

Insert(Int32, InputBinding) Insert(Int32, InputBinding) Insert(Int32, InputBinding) Insert(Int32, InputBinding)

Inserts the specified InputBinding into this InputBindingCollection at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(InputBinding) Remove(InputBinding) Remove(InputBinding) Remove(InputBinding)

Removes the first occurrence of the specified InputBinding from this InputBindingCollection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes the specified InputBinding at the specified index of this InputBindingCollection.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

For a description of this member, see CopyTo(Array, Int32).

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

For a description of this member, see Add(Object).

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

For a description of this member, see Contains(Object).

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

For a description of this member, see IndexOf(Object).

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

For a description of this member, see Insert(Int32, Object).

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

For a description of this member, see Item[Int32].

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

For a description of this member, see Remove(Object).

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also