다음을 통해 공유


FeatureAttribute 클래스

업데이트: 2007년 11월

FeatureProvider 형식을 나타내는 Type 개체를 저장합니다.

네임스페이스:  Microsoft.Windows.Design.Features
어셈블리:  Microsoft.Windows.Design.Extensibility(Microsoft.Windows.Design.Extensibility.dll)

구문

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface, AllowMultiple := True)> _
Public NotInheritable Class FeatureAttribute _
    Inherits Attribute

Dim instance As FeatureAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true)]
public sealed class FeatureAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface, AllowMultiple = true)]
public ref class FeatureAttribute sealed : public Attribute
public final class FeatureAttribute extends Attribute

설명

FeatureAttribute를 사용하여 디자인 타임 기능을 형식에 연결합니다.

이 특성에 정의된 기능 공급자는 디자이너가 요청할 때 인스턴스화됩니다. 자세한 내용은 기능 공급자 및 기능 커넥터를 참조하십시오.

예제

다음 코드 예제에서는 표시기(Adorner) 공급자와 컨트롤 클래스를 연결하는 FeatureAttribute를 만드는 방법을 보여 줍니다. 자세한 내용은 연습: 디자인 타임 표시기 만들기를 참조하십시오.

' Container for any general design-time metadata to initialize.
' Designers look for a type in the design-time assembly that 
' implements IRegisterMetadata. If found, designers instantiate 
' this class and call its Register() method automatically.
Friend Class Metadata
    Implements IRegisterMetadata

    ' Called by the designer to register any design-time metadata.
    Public Sub Register() Implements IRegisterMetadata.Register
        Dim builder As New AttributeTableBuilder()

        ' Add the adorner provider to the design-time metadata.
        builder.AddCustomAttributes(GetType(ButtonWithDesignTime), _
                                    New FeatureAttribute(GetType(OpacitySliderAdornerProvider)))

        MetadataStore.AddAttributeTable(builder.CreateTable())
    End Sub

End Class
// Container for any general design-time metadata to initialize.
// Designers look for a type in the design-time assembly that 
// implements IRegisterMetadata. If found, designers instantiate 
// this class and call its Register() method automatically.
internal class Metadata : IRegisterMetadata
{
    // Called by the designer to register any design-time metadata.
    public void Register()
    {
        AttributeTableBuilder builder = new AttributeTableBuilder();

        // Add the adorner provider to the design-time metadata.
        builder.AddCustomAttributes(
            typeof(ButtonWithDesignTime), 
            new FeatureAttribute(typeof(OpacitySliderAdornerProvider)));

        MetadataStore.AddAttributeTable(builder.CreateTable());
    }
}

상속 계층 구조

System.Object
  System.Attribute
    Microsoft.Windows.Design.Features.FeatureAttribute

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

참고 항목

참조

FeatureAttribute 멤버

Microsoft.Windows.Design.Features 네임스페이스

FeatureProvider

기타 리소스

기능 공급자 및 기능 커넥터