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
Public NotInheritable Class CommandBindingCollection
Implements IList
繼承
CommandBindingCollection
實作

範例

以下範例建立 a 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

建構函式

名稱 Description
CommandBindingCollection()

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

CommandBindingCollection(IList)

使用指定的CommandBindingCollection項目初始化類別的新實例IList

屬性

名稱 Description
Count

取得這個CommandBindingCollection項目的數量CommandBinding

IsFixedSize

會得到一個值,表示這個 CommandBindingCollection 大小是否固定。

IsReadOnly

會獲得一個值,表示是否 CommandBindingCollection 為唯讀。

IsSynchronized

會獲得一個值,表示存取是否 CommandBindingCollection 同步(執行緒安全)。

Item[Int32]

在指定的索引上取得或設定 。CommandBinding

SyncRoot

取得一個物件,可用來同步存取 CommandBindingCollection

方法

名稱 Description
Add(CommandBinding)

在此上加上指定的 CommandBindingCommandBindingCollection

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)

搜尋此CommandBindingCollection中指定 CommandBinding 的首次出現。

Insert(Int32, CommandBinding)

將指定 CommandBinding 值插入到指定的 CommandBindingCollection 索引中。

MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
Remove(CommandBinding)

移除了該 CommandBindingCommandBindingCollection首次出現。

RemoveAt(Int32)

移除 在指定索引 CommandBindingCollection處的指定 CommandBinding

ToString()

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

(繼承來源 Object)

明確介面實作

名稱 Description
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)

擴充方法

名稱 Description
AsParallel(IEnumerable)

啟用查詢的平行處理。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

根據指定的型別篩選 IEnumerable 的專案。

適用於

另請參閱