InputBindingCollection Class
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.
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
type InputBindingCollection = class
interface ICollection
interface IEnumerable
interface IList
Public NotInheritable Class InputBindingCollection
Implements IList
- Inheritance
-
InputBindingCollection
- 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() |
Initializes a new instance of the InputBindingCollection class. |
InputBindingCollection(IList) |
Initializes a new instance of the InputBindingCollection class using the items in the specified IList. |
Properties
Count |
Gets the number of InputBinding items in this collection. |
IsFixedSize |
Gets a value that indicates whether this InputBindingCollection has a fixed size. |
IsReadOnly |
Gets a value that indicates whether this InputBindingCollection is read-only. |
IsSynchronized |
Gets a value indicating whether access to this InputBindingCollection is synchronized (thread-safe). |
Item[Int32] |
Gets or sets the InputBinding at the specified index. |
SyncRoot |
Gets an object that can be used to synchronize access to the InputBindingCollection. |
Methods
Add(InputBinding) |
Adds the specified InputBinding to this InputBindingCollection. |
AddRange(ICollection) |
Adds the items of the specified ICollection to the end of this InputBindingCollection. |
Clear() |
Removes all items from this InputBindingCollection. |
Contains(InputBinding) |
Determines whether the specified InputBinding is in this InputBindingCollection. |
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) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetEnumerator() |
Gets an enumerator that iterates through this InputBindingCollection. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
IndexOf(InputBinding) |
Searches for the first occurrence of the specified InputBinding in this InputBindingCollection. |
Insert(Int32, InputBinding) |
Inserts the specified InputBinding into this InputBindingCollection at the specified index. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
Remove(InputBinding) |
Removes the first occurrence of the specified InputBinding from this InputBindingCollection. |
RemoveAt(Int32) |
Removes the specified InputBinding at the specified index of this InputBindingCollection. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Explicit Interface Implementations
ICollection.CopyTo(Array, Int32) |
For a description of this member, see CopyTo(Array, Int32). |
IList.Add(Object) |
For a description of this member, see Add(Object). |
IList.Contains(Object) |
For a description of this member, see Contains(Object). |
IList.IndexOf(Object) |
For a description of this member, see IndexOf(Object). |
IList.Insert(Int32, Object) |
For a description of this member, see Insert(Int32, Object). |
IList.Item[Int32] |
For a description of this member, see Item[Int32]. |
IList.Remove(Object) |
For a description of this member, see Remove(Object). |
Extension Methods
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
Enables parallelization of a query. |
AsQueryable(IEnumerable) |
Converts an IEnumerable to an IQueryable. |