CommandBindingCollection 類別

定義

表示 CommandBinding 物件的集合。

public ref class CommandBindingCollection sealed : System::Collections::IList
public sealed class CommandBindingCollection : System.Collections.IList
type CommandBindingCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
type CommandBindingCollection = class
    interface ICollection
    interface IEnumerable
    interface IList
Public NotInheritable Class CommandBindingCollection
Implements IList
繼承
CommandBindingCollection
實作

範例

下列範例會建立 , CommandBinding 並將其新增至 CommandBindingCollectionWindow

<Window x:Class="SDKSamples.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:custom="clr-namespace:SDKSamples"
    Height="600" Width="800"
    >
  <Window.CommandBindings>
    <CommandBinding Command="{x:Static custom:Window1.CustomRoutedCommand}"
                    Executed="ExecutedCustomCommand"
                    CanExecute="CanExecuteCustomCommand" />
  </Window.CommandBindings>
CommandBinding customCommandBinding = new CommandBinding(
    CustomRoutedCommand, ExecutedCustomCommand, CanExecuteCustomCommand);

// attach CommandBinding to root window
this.CommandBindings.Add(customCommandBinding);
Dim customCommandBinding As New CommandBinding(CustomRoutedCommand, AddressOf ExecutedCustomCommand, AddressOf CanExecuteCustomCommand)

' attach CommandBinding to root window
Me.CommandBindings.Add(customCommandBinding)

備註

衍生自 UIElement 的所有物件都有 CommandBindingCollection 具名

CommandBindings.

建構函式

CommandBindingCollection()

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

CommandBindingCollection(IList)

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

屬性

Count

取得這個 CommandBindingCommandBindingCollection 項目的數目。

IsFixedSize

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

IsReadOnly

取得值,指出這個 CommandBindingCollection 是否為唯讀。

IsSynchronized

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

Item[Int32]

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

SyncRoot

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

方法

Add(CommandBinding)

將指定的 CommandBinding 加入至這個 CommandBindingCollection

AddRange(ICollection)

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

Clear()

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

Contains(CommandBinding)

判斷指定的 CommandBinding 是否在這個 CommandBindingCollection 中。

CopyTo(CommandBinding[], Int32)

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

Equals(Object)

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

(繼承來源 Object)
GetEnumerator()

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

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(CommandBinding)

在這個 CommandBinding 中搜尋指定之 CommandBindingCollection 的第一個項目。

Insert(Int32, CommandBinding)

將指定之 CommandBinding 插入位於指定索引的這個 CommandBindingCollection

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Remove(CommandBinding)

從這個 CommandBinding 移除指定之 CommandBindingCollection 的第一個項目。

RemoveAt(Int32)

從這個 CommandBinding 的指定索引處移除指定的 CommandBindingCollection

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

適用於

另請參閱