InputBindingCollection 類別

定義

代表 InputBinding 物件的已排序集合。

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
繼承
InputBindingCollection
實作

範例

下列範例會建立 , KeyGesture 並將它與 KeyBinding產生關聯。 會 KeyBinding 新增至 InputBindingCollection 上的 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 的所有物件都有 InputBindingCollection 名為 InputBindings的 。 衍生自 ContentElement 的所有物件都有 InputBindingCollection 名為 InputBindings的 。

不過,如果這些集合是在 XAML 中設定,則集合中的項目必須是的 InputBinding 衍生類別,而不是直接 InputBinding 物件。 這是因為 InputBinding 不支援預設公用建構函式。 因此,XAML 中設定的專案 InputBindingCollection 通常是 InputBinding 支援預設公用建構函式的衍生類別,例如 KeyBindingMouseBinding

建構函式

InputBindingCollection()

初始化 InputBindingCollection 類別的新執行個體。

InputBindingCollection(IList)

使用指定之 InputBindingCollection 中的項目,初始化 IList 類別的新執行個體。

屬性

Count

取得這個集合中的 InputBinding 項目數。

IsFixedSize

取得值,這個值會指出 InputBindingCollection 是否有固定的大小。

IsReadOnly

取得值,該值指出這個 InputBindingCollection 是否唯讀。

IsSynchronized

取得值,指出對這個 InputBindingCollection 的存取是否已同步處理 (安全執行緒)。

Item[Int32]

取得或設定在指定索引處的 InputBinding

SyncRoot

取得可用以同步存取 InputBindingCollection 的物件。

方法

Add(InputBinding)

將指定的 InputBinding 加入至這個 InputBindingCollection

AddRange(ICollection)

將指定 ICollection 的項目加入至這個 InputBindingCollection 的結尾。

Clear()

將所有項目從這個 InputBindingCollection 移除。

Contains(InputBinding)

判斷指定的 InputBinding 是否在這個 InputBindingCollection 中。

CopyTo(InputBinding[], Int32)

InputBindingCollection 中的所有項目複製到指定的一維陣列,從目標陣列的指定索引開始。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

取得可逐一查看這個 InputBindingCollection 的列舉程式。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(InputBinding)

在這個 InputBinding 中搜尋指定之 InputBindingCollection 的第一個項目。

Insert(Int32, InputBinding)

將指定之 InputBinding 插入位於指定索引的這個 InputBindingCollection

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Remove(InputBinding)

從這個 InputBinding 移除指定之 InputBindingCollection 的第一個項目。

RemoveAt(Int32)

從這個 InputBinding 的指定索引處移除指定的 InputBindingCollection

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

如需這個成員的說明,請參閱 CopyTo(Array, Int32)

IList.Add(Object)

如需這個成員的說明,請參閱 Add(Object)

IList.Contains(Object)

如需這個成員的說明,請參閱 Contains(Object)

IList.IndexOf(Object)

如需這個成員的說明,請參閱 IndexOf(Object)

IList.Insert(Int32, Object)

如需這個成員的說明,請參閱 Insert(Int32, Object)

IList.Item[Int32]

如需這個成員的說明,請參閱 Item[Int32]

IList.Remove(Object)

如需這個成員的說明,請參閱 Remove(Object)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱