CommandBindingCollection 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 CommandBinding 对象集合。
public ref class CommandBindingCollection sealed : System::Collections::IListpublic sealed class CommandBindingCollection : System.Collections.IListtype CommandBindingCollection = class
    interface IList
    interface ICollection
    interface IEnumerabletype CommandBindingCollection = class
    interface ICollection
    interface IEnumerable
    interface IListPublic NotInheritable Class CommandBindingCollection
Implements IList- 继承
- 
				CommandBindingCollection
- 实现
示例
以下示例创建 并将其CommandBinding添加到 CommandBindingCollection 的 。Window
<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 的
构造函数
| CommandBindingCollection() | 初始化 CommandBindingCollection 类的新实例。 | 
| CommandBindingCollection(IList) | 使用指定的 CommandBindingCollection 中的项初始化 IList 类的新实例。 | 
属性
| Count | 获取此 CommandBinding 中的 CommandBindingCollection 项数。 | 
| 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。 |