C# .Net 4.5 PropertyGrid: how to hide Properties
See the question and my original answer on StackOverflowWhat you could do is reuse the DynamicTypeDescriptor
class described in my answer to this question here on SO: PropertyGrid Browsable not found for entity framework created property, how to find it?
like this for example:
public Form1()
{
InitializeComponent();
DynamicTypeDescriptor dt = new DynamicTypeDescriptor(typeof(Question));
Question q = new Question(); // initialize question the way you want
if (q.Element == 0)
{
dt.RemoveProperty("Element");
}
propertyGrid1.SelectedObject = dt.FromComponent(q);
}