MenuItemCollectionEditor クラス
アセンブリ: System.Design (system.design.dll 内)
構文
MenuItemCollectionEditor クラスは、関連付けられた Menu コントロール内の Items プロパティで指定されているコレクションの、MenuItem 要素を編集するためのユーザー インターフェイスを提供します。
MenuItemCollectionEditor は、ビジュアルなデザイナの [プロパティ] グリッドの [Items] プロパティにある省略記号 ([...]) ボタンをクリックするか、コントロールの [よく使う機能] コンテキスト メニューの [メニュー項目の編集] をクリックすると表示されます。
EditValue メソッドは、関連付けられた Menu コントロールのメニュー項目コレクションの値を編集します。GetEditStyle メソッドは、このエディタに関連付けられている編集スタイルを取得します。
EditorAttribute 属性を使用して、MenuItemCollectionEditor クラスと UITypeEditor クラス (コレクション エディタの基本クラス) をカスタム コントロールのプロパティに関連付ける方法を次のコード例に示します。この例のカスタム コントロールは、WebControl クラスから派生しており、MenuItemCollection コレクションを取得して設定します。
Private menuItems As MenuItemCollection ' Associate the MenuItemCollectionEditor with the Items. <EditorAttribute( GetType(System.Web.UI.Design.WebControls. _ MenuItemCollectionEditor), _ GetType(UITypeEditor))> _ Public Property Items() As MenuItemCollection Get If menuItems Is Nothing Then menuItems = New MenuItemCollection() End If Return menuItems End Get Set menuItems = value End Set End Property ' Items
private MenuItemCollection menuItems; // Associate the MenuItemCollectionEditor with the Items. [Editor(typeof(System.Web.UI.Design.WebControls. MenuItemCollectionEditor), typeof(UITypeEditor))] public MenuItemCollection Items { get { // If there is no menuItems collection, create it. if (menuItems == null) menuItems = new MenuItemCollection(); return menuItems; } set { menuItems = value; } } // Items
System.Drawing.Design.UITypeEditor
System.Web.UI.Design.WebControls.MenuItemCollectionEditor
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- MenuItemCollectionEditor クラスのページへのリンク