Items コレクション内のメニュー項目をサブメニューに追加するかどうかを示す値を取得または設定します。
名前空間: Microsoft.Windows.Design.Interaction
アセンブリ: Microsoft.Windows.Design.Interaction (Microsoft.Windows.Design.Interaction.dll 内)
構文
'宣言
Public Property HasDropDown As Boolean
Get
Set
public bool HasDropDown { get; set; }
public:
property bool HasDropDown {
bool get ();
void set (bool value);
}
member HasDropDown : bool with get, set
function get HasDropDown () : boolean
function set HasDropDown (value : boolean)
プロパティ値
型: System.Boolean
項目コレクション内のメニュー項目をサブメニューに追加する場合は true。コレクション内の項目を現在のメニューに直接追加して、その前後に区分線を挿入する場合は false。
解説
HasDropDown が true の場合、コレクション内のメニュー項目はサブメニューに追加されます。 DisplayName プロパティが MenuGroup に設定されているメニュー項目は現在のメニューに追加され、そのメニュー項目はサブメニューに追加されます。 HasDropDown が false の場合、コレクション内のメニュー項目は現在のメニューに直接追加され、その前後に区分線が挿入されます。 たとえば、Layout という名前のメニュー グループがあり、[Align Left] および [Align Right] というメニュー項目が含まれているとします。 HasDropDown が true の場合、現在のメニューに [Layout] メニューが追加され、[Align Left] と [Align Right] はサブメニュー項目になります。 HasDropDown が false の場合は、現在のメニューに [Align Left] と [Align Right] が追加され、[Align Left] の前と [Align Right] の後に区分線が挿入されます。
例
2 つの MenuAction 項目をセットアップし、これらを MenuGroup に割り当てる方法を次のコード例に示します。 サブメニュー動作を有効にするために、HasDropDown プロパティを true に設定しています。 詳細については、「チュートリアル: メニュー プロバイダーの作成」を参照してください。
' The provider's constructor sets up the MenuAction objects
' and the the MenuGroup which holds them.
Public Sub New()
' Set up the MenuAction which sets the control's
' background to Blue.
setBackgroundToBlueMenuAction = New MenuAction("Blue")
setBackgroundToBlueMenuAction.Checkable = True
AddHandler setBackgroundToBlueMenuAction.Execute, AddressOf SetBackgroundToBlue_Execute
' Set up the MenuAction which sets the control's
' background to its default value.
clearBackgroundMenuAction = New MenuAction("Cleared")
clearBackgroundMenuAction.Checkable = True
AddHandler clearBackgroundMenuAction.Execute, AddressOf ClearBackground_Execute
' Set up the MenuGroup which holds the MenuAction items.
Dim backgroundFlyoutGroup As New MenuGroup("SetBackgroundsGroup", "Set Background")
' If HasDropDown is false, the group appears inline,
' instead of as a flyout. Set to true.
backgroundFlyoutGroup.HasDropDown = True
backgroundFlyoutGroup.Items.Add(setBackgroundToBlueMenuAction)
backgroundFlyoutGroup.Items.Add(clearBackgroundMenuAction)
Me.Items.Add(backgroundFlyoutGroup)
' The UpdateItemStatus event is raised immediately before
' this provider shows its tabs, which provides the opportunity
' to set states.
AddHandler UpdateItemStatus, AddressOf CustomContextMenuProvider_UpdateItemStatus
End Sub
// The provider's constructor sets up the MenuAction objects
// and the the MenuGroup which holds them.
public CustomContextMenuProvider()
{
// Set up the MenuAction which sets the control's
// background to Blue.
setBackgroundToBlueMenuAction = new MenuAction("Blue");
setBackgroundToBlueMenuAction.Checkable = true;
setBackgroundToBlueMenuAction.Execute +=
new EventHandler<MenuActionEventArgs>(SetBackgroundToBlue_Execute);
// Set up the MenuAction which sets the control's
// background to its default value.
clearBackgroundMenuAction = new MenuAction("Cleared");
clearBackgroundMenuAction.Checkable = true;
clearBackgroundMenuAction.Execute +=
new EventHandler<MenuActionEventArgs>(ClearBackground_Execute);
// Set up the MenuGroup which holds the MenuAction items.
MenuGroup backgroundFlyoutGroup =
new MenuGroup("SetBackgroundsGroup", "Set Background");
// If HasDropDown is false, the group appears inline,
// instead of as a flyout. Set to true.
backgroundFlyoutGroup.HasDropDown = true;
backgroundFlyoutGroup.Items.Add(setBackgroundToBlueMenuAction);
backgroundFlyoutGroup.Items.Add(clearBackgroundMenuAction);
this.Items.Add(backgroundFlyoutGroup);
// The UpdateItemStatus event is raised immediately before
// this provider shows its tabs, which provides the opportunity
// to set states.
UpdateItemStatus +=
new EventHandler<MenuActionEventArgs>(
CustomContextMenuProvider_UpdateItemStatus);
}
.NET Framework セキュリティ
- 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
参照
Microsoft.Windows.Design.Interaction 名前空間
PrimarySelectionContextMenuProvider