PropertyGrid.ToolbarVisible Property

Definition

Gets or sets a value indicating whether the toolbar is visible.

C#
public virtual bool ToolbarVisible { get; set; }

Property Value

true if the toolbar is visible; otherwise, false. The default is true.

Examples

The following code example demonstrates initializing a PropertyGrid control using the PropertySort, ToolbarVisible properties. In addition, this example sets the PropertyGrid control's Visible property to false so the grid will not be visible when the example is run. To run this example paste the following code in a form and call the InitializePropertyGrid method from the form's constructor or Load event-handling method. To view the property grid when the form is running, change the grid's Visible property to true, recompile, and rerun the form.

C#

// Declare a propertyGrid.
internal PropertyGrid propertyGrid1;

// Initialize propertyGrid1.
private void InitializePropertyGrid()
{
    propertyGrid1 = new PropertyGrid();
    propertyGrid1.Name = "PropertyGrid1";
    propertyGrid1.Location = new System.Drawing.Point(185, 20);
    propertyGrid1.Size = new System.Drawing.Size(150, 300);
    propertyGrid1.TabIndex = 5;

    // Set the sort to alphabetical and set Toolbar visible
    // to false, so the user cannot change the sort.
    propertyGrid1.PropertySort = PropertySort.Alphabetical;
    propertyGrid1.ToolbarVisible = false;
    propertyGrid1.Text = "Property Grid";

    // Add the PropertyGrid to the form, but set its
    // visibility to False so it will not appear when the form loads.
    propertyGrid1.Visible = false;
    this.Controls.Add(propertyGrid1);
}

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9