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 型で公開されるメンバーは以下のとおりです。

コンストラクター

  名前 説明
パブリック メソッド ToolboxBrowsableAttribute ToolboxBrowsableAttribute クラスの新しいインスタンスを初期化します。

このページのトップへ

プロパティ

  名前 説明
パブリック プロパティ Browsable この属性に関連付けられている Browsable フラグを取得します。
パブリック プロパティ静的メンバー No Browsable を false に設定して、ToolboxBrowsableAttribute を取得します。
パブリック プロパティ TypeId 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 (Attribute から継承されます。)
パブリック プロパティ静的メンバー Yes Browsable を true に設定して、ToolboxBrowsableAttribute を取得します。

このページのトップへ

メソッド

  名前 説明
パブリック メソッド Equals インフラストラクチャ。 このインスタンスが、指定したオブジェクトに等しいかどうかを示す値を返します。 (Attribute から継承されます。)
プロテクト メソッド Finalize オブジェクトがガベージ コレクションにより収集される前に、そのオブジェクトがリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。)
パブリック メソッド GetHashCode 対象のインスタンスのハッシュ コードを返します。 (Attribute から継承されます。)
パブリック メソッド GetType 現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド Match 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
プロテクト メソッド MemberwiseClone 現在の Object の簡易コピーを作成します。 (Object から継承されます。)
パブリック メソッド ToString 現在のオブジェクトを表す文字列を返します。 (Object から継承されます。)

このページのトップへ

明示的インターフェイスの実装

  名前 説明
明示的なインターフェイス実装プライベート メソッド _Attribute.GetIDsOfNames 名前のセットを対応するディスパッチ識別子のセットにマッピングします。 (Attribute から継承されます。)
明示的なインターフェイス実装プライベート メソッド _Attribute.GetTypeInfo オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (Attribute から継承されます。)
明示的なインターフェイス実装プライベート メソッド _Attribute.GetTypeInfoCount オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (Attribute から継承されます。)
明示的なインターフェイス実装プライベート メソッド _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

その他の技術情報

チュートリアル : デザイン時装飾の作成