Reputation: 145
I have statusbar strip with ToolStripMenuItems. I need to gruop the Toolstrip menu items and Implement TriStateCheckbox functionality,
Upvotes: 1
Views: 531
Reputation: 125197
To have a three-state menu item, you can set CheckState
of each ToolStripMenuItem
to Indeterminate
, Checked
or Unchecked
.
Also if you want to use a tree-view control (which doesn't have builtin support for three-state check boxes) or something like this control, you should know, you can host any control in drop-down using ToolStripControlHost
. For example, here is a ToolStripTreeView
control:
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ContextMenuStrip)]
public class ToolStripTreeView : ToolStripControlHost
{
[DesignerSerializationVisibility( DesignerSerializationVisibility.Content)]
public TreeView TreeViewControl { get { return (TreeView)Control; } }
public ToolStripTreeView() : base(CreateControl()) { }
private static TreeView CreateControl()
{
var t = new TreeView();
return t;
}
}
Upvotes: 1