CommandBindingCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 对象的集合 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 并将其添加到 CommandBindingCollection a 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 | |
| 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) |
在指定的索引处插入指定CommandBindingCommandBindingCollection内容。 |
| 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)。 |
扩展方法
| 名称 | 说明 |
|---|---|
| AsParallel(IEnumerable) |
启用查询的并行化。 |
| AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。 |
| Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定类型。 |
| OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。 |