更新 : 2007 年 11 月
このメニュー項目で、チェック ボックスを表示するユーザー インターフェイス (UI) が必要とされるかどうかを示す値を取得または設定します。
名前空間 : Microsoft.Windows.Design.Interaction
アセンブリ : Microsoft.Windows.Design.Extensibility (Microsoft.Windows.Design.Extensibility.dll 内)
構文
'宣言
Public Property Checkable As Boolean
'使用
Dim instance As MenuAction
Dim value As Boolean
value = instance.Checkable
instance.Checkable = value
public bool Checkable { get; set; }
public:
property bool Checkable {
bool get ();
void set (bool value);
}
public function get Checkable () : boolean
public function set Checkable (value : boolean)
プロパティ値
型 : System.Boolean
メニュー項目にチェック ボックスが必要な場合は true。それ以外の場合は false。既定値は false です。
例
デザイン時にコントロールの Background プロパティを設定する 2 つの MenuAction 項目をセットアップする方法を次のコード例に示します。詳細については、「チュートリアル : MenuAction の作成」を参照してください。
' 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);
}
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
参照
Microsoft.Windows.Design.Interaction 名前空間
PrimarySelectionContextMenuProvider