c# hide/remove properties from propertygrid
-
How can i hide/remove some of the properties from a propertygrid. I have a used a property grid in my project to display the properties of a label and picturebox in runtime, but i do not want all the properties to be displayed. please help Janardhan
-
How can i hide/remove some of the properties from a propertygrid. I have a used a property grid in my project to display the properties of a label and picturebox in runtime, but i do not want all the properties to be displayed. please help Janardhan
-
Given below is is my implementation, where should i add [Browsable(false)] or [Browsable(true)] PropertyGrid pgGrid = new PropertyGrid(); pgGrid.CommandsVisibleIfAvailable = true; pgGrid.Height = 400; pgGrid.Width = 250; pgGrid.Location = new Point(this.Width - (pgGrid.Width + 10), 0); pgGrid.Dock = DockStyle.Fill; this.Controls.Add(pgGrid); pgGrid.Visible = true; pgGrid.SelectedObject = label1; Regards Janardhan
-
Given below is is my implementation, where should i add [Browsable(false)] or [Browsable(true)] PropertyGrid pgGrid = new PropertyGrid(); pgGrid.CommandsVisibleIfAvailable = true; pgGrid.Height = 400; pgGrid.Width = 250; pgGrid.Location = new Point(this.Width - (pgGrid.Width + 10), 0); pgGrid.Dock = DockStyle.Fill; this.Controls.Add(pgGrid); pgGrid.Visible = true; pgGrid.SelectedObject = label1; Regards Janardhan
in your label1. This is just sample :
using System;
using System.ComponentModel;
using System.Windows.Forms;namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void Form1\_Load(object sender, EventArgs e) { MyClass myClass = new MyClass(); propertyGrid1.SelectedObject = myClass; }
}
public class MyClass
{
private int _thisIsNotVisible;
private int _thisIsVisible;\[Browsable(true)\] public int ThisIsVisible { get { return \_thisIsVisible; } set { \_thisIsVisible = value; } } \[Browsable(false)\] public int ThisIsNotVisible { get { return \_thisIsNotVisible; } set { \_thisIsNotVisible = value; } }
}
} -
in your label1. This is just sample :
using System;
using System.ComponentModel;
using System.Windows.Forms;namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void Form1\_Load(object sender, EventArgs e) { MyClass myClass = new MyClass(); propertyGrid1.SelectedObject = myClass; }
}
public class MyClass
{
private int _thisIsNotVisible;
private int _thisIsVisible;\[Browsable(true)\] public int ThisIsVisible { get { return \_thisIsVisible; } set { \_thisIsVisible = value; } } \[Browsable(false)\] public int ThisIsNotVisible { get { return \_thisIsNotVisible; } set { \_thisIsNotVisible = value; } }
}
}Where is label1 used here?
-
Where is label1 used here?
Given below is is my implementation, where should i add [Browsable(false)] or [Browsable(true)]
PropertyGrid pgGrid = new PropertyGrid();
pgGrid.CommandsVisibleIfAvailable = true;
pgGrid.Height = 400;
pgGrid.Width = 250;
pgGrid.Location = new Point(this.Width - (pgGrid.Width + 10), 0);
pgGrid.Dock = DockStyle.Fill;
this.Controls.Add(pgGrid);
pgGrid.Visible = true;
pgGrid.SelectedObject = label1; <--- here!