GridCellLengthAttribute 类

此类将网格单元格大小与 MEF 导出相关联。

继承层次结构

Object
  Attribute
    Microsoft.VisualStudio.Utilities.SingletonBaseMetadataAttribute
      Microsoft.VisualStudio.Text.Editor.GridCellLengthAttribute

命名空间:  Microsoft.VisualStudio.Text.Editor
程序集:  Microsoft.VisualStudio.Text.UI.Wpf(在 Microsoft.VisualStudio.Text.UI.Wpf.dll 中)

语法

声明
<MetadataAttributeAttribute> _
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := False)> _
Public NotInheritable Class GridCellLengthAttribute _
    Inherits SingletonBaseMetadataAttribute
[MetadataAttributeAttribute]
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
public sealed class GridCellLengthAttribute : SingletonBaseMetadataAttribute
[MetadataAttributeAttribute]
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Method|AttributeTargets::Property|AttributeTargets::Field, AllowMultiple = false)]
public ref class GridCellLengthAttribute sealed : public SingletonBaseMetadataAttribute
[<Sealed>]
[<MetadataAttributeAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)>]
type GridCellLengthAttribute =  
    class 
        inherit SingletonBaseMetadataAttribute 
    end
public final class GridCellLengthAttribute extends SingletonBaseMetadataAttribute

GridCellLengthAttribute 类型公开以下成员。

构造函数

  名称 说明
公共方法 GridCellLengthAttribute 初始化 GridCellLengthAttribute 的新实例。

页首

属性

  名称 说明
公共属性 GridCellLength 获取单元格的长度。
公共属性 TypeId 当在派生类中实现时,获取该 Attribute 的唯一标识符。 (继承自 Attribute。)

页首

方法

  名称 说明
公共方法 Equals 基础结构。 返回一个值,该值指示此实例是否与指定的对象相等。 (继承自 Attribute。)
公共方法 GetHashCode 返回此实例的哈希代码。 (继承自 Attribute。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
公共方法 IsDefaultAttribute 当在派生类中重写时,指示此实例的值是否是派生类的默认值。 (继承自 Attribute。)
公共方法 Match 当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 (继承自 Attribute。)
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)

页首

显式接口实现

  名称 说明
显式接口实现私有方法 System#Runtime#InteropServices#_Attribute#GetIDsOfNames 将一组名称映射为对应的一组调度标识符。 (继承自 Attribute。)
显式接口实现私有方法 System#Runtime#InteropServices#_Attribute#GetTypeInfo 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 (继承自 Attribute。)
显式接口实现私有方法 System#Runtime#InteropServices#_Attribute#GetTypeInfoCount 检索对象提供的类型信息接口的数量(0 或 1)。 (继承自 Attribute。)
显式接口实现私有方法 System#Runtime#InteropServices#_Attribute#Invoke 提供对某一对象公开的属性和方法的访问。 (继承自 Attribute。)

页首

备注

使用者用于此属性的值决定呈现导出的对象的行为。 所呈现的行为与 WPF 定义的行为类别 (即。 Grid)。 GridLength交互。 此类在 Grid用于与 GridUnitTypeAttribute 的组合创建单元格的 GridLength

示例

[Export(typeof(IWpfTextViewMarginProvider))]
[Name(PredefinedMarginNames.VerticalScrollBar)]
[MarginContainer(PredefinedMarginNames.VerticalScrollBarContainerMargin)]
[ContentType("text")]
[TextViewRole(PredefinedTextViewRoles.Interactive)]
[GridUnitType(GridUnitType.Pixel)] //this size is expressed as a pixel using the GridCellLength attribute
[GridCellLength(15)] //15 pixels wide
internal sealed class VerticalScrollBarMarginProvider : IWpfTextViewMarginProvider { */ implementation /* }

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参阅

参考

Microsoft.VisualStudio.Text.Editor 命名空间