다음을 통해 공유


ToolboxBrowsableAttribute 클래스

디자이너의 도구 상자 브라우저에서 컨트롤이 표시되는지 여부를 지정합니다.

상속 계층 구조

System.Object
  System.Attribute
    Microsoft.Windows.Design.ToolboxBrowsableAttribute

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

구문

‘선언
<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class ToolboxBrowsableAttribute _
    Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class)]
public sealed class ToolboxBrowsableAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)]
public ref class ToolboxBrowsableAttribute sealed : public Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Class)>]
type ToolboxBrowsableAttribute =  
    class
        inherit Attribute
    end
public final class ToolboxBrowsableAttribute extends Attribute

ToolboxBrowsableAttribute 형식에서는 다음과 같은 멤버를 노출합니다.

생성자

  이름 설명
Public 메서드 ToolboxBrowsableAttribute ToolboxBrowsableAttribute 클래스의 새 인스턴스를 초기화합니다.

위쪽

속성

  이름 설명
Public 속성 Browsable 이 특성에 연결된 Browsable 플래그를 가져옵니다.
Public 속성정적 멤버 No Browsable 이 false로 설정된 ToolboxBrowsableAttribute를 가져옵니다.
Public 속성 TypeId 파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다. (Attribute에서 상속됨)
Public 속성정적 멤버 Yes Browsable 이 true로 설정된 ToolboxBrowsableAttribute를 가져옵니다.

위쪽

메서드

  이름 설명
Public 메서드 Equals 인프라입니다. 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다. (Attribute에서 상속됨)
Protected 메서드 Finalize 가비지 수집에서 회수하기 전에 개체에서 리소스를 해제하고 다른 정리 작업을 수행할 수 있게 합니다. (Object에서 상속됨)
Public 메서드 GetHashCode 이 인스턴스에 대한 해시 코드를 반환합니다. (Attribute에서 상속됨)
Public 메서드 GetType 현재 인스턴스의 Type을 가져옵니다. (Object에서 상속됨)
Public 메서드 IsDefaultAttribute 파생 클래스에서 재정의된 경우 이 인스턴스의 값이 파생 클래스의 기본값인지 여부를 나타냅니다. (Attribute에서 상속됨)
Public 메서드 Match 파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다. (Attribute에서 상속됨)
Protected 메서드 MemberwiseClone 현재 Object의 단순 복사본을 만듭니다. (Object에서 상속됨)
Public 메서드 ToString 현재 개체를 나타내는 문자열을 반환합니다. (Object에서 상속됨)

위쪽

명시적 인터페이스 구현

  이름 설명
명시적 인터페이스 구현Private 메서드 _Attribute.GetIDsOfNames 이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다. (Attribute에서 상속됨)
명시적 인터페이스 구현Private 메서드 _Attribute.GetTypeInfo 인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다. (Attribute에서 상속됨)
명시적 인터페이스 구현Private 메서드 _Attribute.GetTypeInfoCount 개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1). (Attribute에서 상속됨)
명시적 인터페이스 구현Private 메서드 _Attribute.Invoke 개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다. (Attribute에서 상속됨)

위쪽

설명

ToolboxBrowsableAttribute를 사용하여 컨트롤이 WPF Designer for Visual Studio의 도구 상자 항목 선택 대화 상자 또는 Microsoft Blend의 자산 라이브러리에 표시되는지 여부를 지정합니다.

예제

다음 코드 예제에서는 ToolboxBrowsableAttribute를 사용하여 디자이너의 도구 상자 브라우저에 사용자 지정 컨트롤을 표시하는 방법을 보여 줍니다.

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.ComponentModel
Imports System.Windows.Media
Imports System.Windows.Controls
Imports System.Windows

Imports Microsoft.Windows.Design
Imports Microsoft.Windows.Design.Features
Imports Microsoft.Windows.Design.Metadata

' The ProvideMetadata assembly-level attribute indicates to designers
' that this assembly contains a class that provides an attribute table. 
<Assembly: ProvideMetadata(GetType(CustomControlLibrary.Design.Metadata))> 

Public Class ButtonWithDesignTime
    Inherits Button
End Class

' Container for any general design-time metadata to initialize.
' Designers look for a type in the design-time assembly that 
' implements IProvideAttributeTable. If found, designers instantiate
' this class and access its AttributeTable property automatically.
Friend Class Metadata
    Implements IProvideAttributeTable

    ' Accessed by the designer to register any design-time metadata.
    Public ReadOnly Property AttributeTable() As AttributeTable _
        Implements IProvideAttributeTable.AttributeTable
        Get
            Dim builder As New AttributeTableBuilder()

            builder.AddCustomAttributes( _
                GetType(ButtonWithDesignTime), _
                New ToolboxBrowsableAttribute(True))

            Return builder.CreateTable()
        End Get
    End Property

End Class
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows;

using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Features;
using Microsoft.Windows.Design.Metadata;

// The ProvideMetadata assembly-level attribute indicates to designers
// that this assembly contains a class that provides an attribute table. 
[assembly: ProvideMetadata(typeof(CustomControlLibrary.Design.Metadata))]

namespace CustomControlLibrary.Design
{
    public class ButtonWithDesignTime : Button
    {
    }

    // Container for any general design-time metadata to initialize.
    // Designers look for a type in the design-time assembly that 
    // implements IProvideAttributeTable. If found, designers instantiate 
    // this class and access its AttributeTable property automatically.
    internal class Metadata : IProvideAttributeTable
    {
        // Accessed by the designer to register any design-time metadata.
        public AttributeTable AttributeTable
        {
            get 
            {
                AttributeTableBuilder builder = new AttributeTableBuilder();

                builder.AddCustomAttributes(
                    typeof(ButtonWithDesignTime),
                    new ToolboxBrowsableAttribute(true));

                return builder.CreateTable();
            }
        }
    }
}

스레드로부터의 안전성

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

참고 항목

참조

Microsoft.Windows.Design 네임스페이스

AttributeTableBuilder

기타 리소스

연습: 디자인 타임 표시기 만들기