InputBindingCollection 類別

定義

表示已排序的 InputBinding 物件集合。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
繼承
InputBindingCollection
實作

範例

下列範例會建立KeyGesture , 並將它KeyBinding與產生關聯。The following example creates a KeyGesture and associates it with a KeyBinding. 會加入至上InputBindingCollection Window的。 KeyBindingThe 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)

備註

所有衍生自UIElement的物件都具有名InputBindings為的InputBindingCollectionAll objects that derive from UIElement have an InputBindingCollection named InputBindings. 所有衍生自ContentElement的物件都具有名InputBindings為的InputBindingCollectionAll objects that derive from ContentElement have an InputBindingCollection named InputBindings.

不過, 如果在中XAMLXAML設定這些集合, 則集合中的專案必須是衍生InputBinding類別, 而不是直接InputBinding物件。However, if these collections are set in XAMLXAML, then the items in the collection must be derived classes of InputBinding rather than direct InputBinding objects. 這是因為InputBinding不支援預設的公用函數。This is because InputBinding does not support a default public constructor. 因此, InputBindingCollection在中XAMLXAML設定的專案通常會是KeyBinding支援預設公用函InputBinding式的衍生類別, 例如或。 MouseBindingTherefore, the items in a InputBindingCollection that was set in XAMLXAML will typically be an InputBinding derived class that does support a default public constructor, such as KeyBinding or MouseBinding.

建構函式

InputBindingCollection()

初始化 InputBindingCollection 類別的新執行個體。Initializes a new instance of the InputBindingCollection class.

InputBindingCollection(IList)

使用指定之 InputBindingCollection 中的項目,初始化 IList 類別的新執行個體。Initializes a new instance of the InputBindingCollection class using the items in the specified IList.

屬性

Count

取得這個集合中的 InputBinding 項目數。Gets the number of InputBinding items in this collection.

IsFixedSize

取得值,這個值會指出 InputBindingCollection 是否有固定的大小。Gets a value that indicates whether this InputBindingCollection has a fixed size.

IsReadOnly

取得值,這個值表示這個 InputBindingCollection 是否為唯讀。Gets a value that indicates whether this InputBindingCollection is read-only.

IsSynchronized

取得值,指出對這個 InputBindingCollection 的存取是否已同步處理 (安全執行緒)。Gets a value indicating whether access to this InputBindingCollection is synchronized (thread-safe).

Item[Int32]

取得或設定在指定索引處的 InputBindingGets or sets the InputBinding at the specified index.

SyncRoot

取得可用以同步存取 InputBindingCollection 的物件。Gets an object that can be used to synchronize access to the InputBindingCollection.

方法

Add(InputBinding)

將指定的 InputBinding 加入至這個 InputBindingCollectionAdds the specified InputBinding to this InputBindingCollection.

AddRange(ICollection)

將指定 ICollection 的項目加入至這個 InputBindingCollection 的結尾Adds the items of the specified ICollection to the end of this InputBindingCollection

Clear()

將所有項目從這個 InputBindingCollection 移除。Removes all items from this InputBindingCollection.

Contains(InputBinding)

判斷指定的 InputBinding 是否在此 InputBindingCollectionDetermines whether the specified InputBinding is in this InputBindingCollection

CopyTo(InputBinding[], Int32)

InputBindingCollection 中的所有項目複製到指定的一維陣列,從目標陣列的指定索引開始。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.

(繼承來源 Object)
GetEnumerator()

取得可逐一查看這個 InputBindingCollection 的列舉程式。Gets an enumerator that iterates through this InputBindingCollection.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(InputBinding)

在這個 InputBinding 中搜尋指定 InputBindingCollection 的第一個項目。Searches for the first occurrence of the specified InputBinding in his InputBindingCollection.

Insert(Int32, InputBinding)

將指定之 InputBinding 插入位於指定索引的這個 InputBindingCollectionInserts the specified InputBinding into this InputBindingCollection at the specified index.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(InputBinding)

從這個 InputBinding 移除指定之 InputBindingCollection 的第一個項目。Removes the first occurrence of the specified InputBinding from this InputBindingCollection.

RemoveAt(Int32)

從這個 InputBinding 的指定索引處移除指定的 InputBindingCollectionRemoves the specified InputBinding at the specified index of this InputBindingCollection.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

如需這個成員的說明,請參閱 CopyTo(Array, Int32)For a description of this member, see CopyTo(Array, Int32).

IList.Add(Object)

如需這個成員的說明,請參閱 Add(Object)For a description of this member, see Add(Object).

IList.Contains(Object)

如需這個成員的說明,請參閱 Contains(Object)For a description of this member, see Contains(Object).

IList.IndexOf(Object)

如需這個成員的說明,請參閱 IndexOf(Object)For a description of this member, see IndexOf(Object).

IList.Insert(Int32, Object)

如需這個成員的說明,請參閱 Insert(Int32, Object)For a description of this member, see Insert(Int32, Object).

IList.Item[Int32]

如需這個成員的說明,請參閱 Item[Int32]For a description of this member, see Item[Int32].

IList.Remove(Object)

如需這個成員的說明,請參閱 Remove(Object)For a description of this member, see Remove(Object).

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱