.NET control for providing a UI that allows the properties of one or more objects to be viewed and edited.
Questions tagged [propertygrid]
958 questions
14
votes
6 answers
Remove C# attribute of a property dynamically
I have a class with a set of properties As given below.
class ContactInfo
{
[ReadOnly(true)]
[Category("Contact Info")]
public string Mobile { get; set; }
[Category("Contact Info")]
public string Name{ get; set; }
}
The objects…

SysAdmin
- 5,455
- 8
- 33
- 34
14
votes
7 answers
How can I set the column width of a Property Grid?
I am using property grid in my application to display the name and value of the properties of an object.
By default the width of the columns (name and property) are at a ratio of 50:50.
and we have an option of sliding the splitter to change this…

Ali Ahmadi
- 2,387
- 4
- 31
- 48
14
votes
4 answers
How to add property-level Attribute to the TypeDescriptor at runtime?
I want to add some custom PropertyGrid-centric Attributes to the object's properties, to provide richer editing, hide some values and group them in categories, because that class I'm working with doesn't provide such functionality and I can't do…

Gman
- 1,781
- 1
- 23
- 38
14
votes
5 answers
PropertyGrid doesn't notice properties changed in code?
I have a Winform application which uses colour to highlight certain things. I would like to allow the users to change 'their' colours. As an exercise, I thought I would create an instance of a class, with properties for the colours, and assign it…

Black Light
- 2,358
- 5
- 27
- 49
12
votes
5 answers
Default built-in editors for the PropertyGrid control
I can't seem to find the answer to this anywhere. What default editors/converters are building into 3.5 Framework PropertyGrid control. Otherwise what object types can I throw at it and it be able to reliably show and edit? I've found a lot of…

Eric Anastas
- 21,675
- 38
- 142
- 236
12
votes
1 answer
How do I view object properties in PropertyGrid?
At the moment I have an object of type A which is being viewed by the PropertyGrid. However, one of its properties is of type B. The property which is of type B is not expandable. How can I change this so that:
a) I can expand custom object…

LunchMarble
- 5,079
- 9
- 64
- 94
12
votes
1 answer
How can I force the PropertyGrid to show a custom dialog for a specific property?
I have a class with a string property, having both a getter and a setter, that is often so long that the PropertyGrid truncates the string value. How can I force the PropertyGrid to show an ellipsis and then launch a dialog that contains a multiline…

flipdoubt
- 13,897
- 15
- 64
- 96
12
votes
2 answers
Implementing sub fields in a PropertyGrid
Alright so my terminology when it comes to C# isn't great, so I'll attempt to explain this with a small example. If you create a class which you are using within a PropertyGrid and you have the following values:
class Test
{
public Point…

tplaner
- 8,363
- 3
- 31
- 47
12
votes
3 answers
How can I get an OpenFileDialog in a custom control's property grid?
I'm creating a .net custom control and it should be able to load multiple text files. I have a public property named ListFiles with those properties set :
[Browsable(true), Category("Configuration"), Description("List of Files to Load")]
public…

Gad
- 41,526
- 13
- 54
- 78
12
votes
5 answers
Convert string array to enum on the fly
I am binding an enum to a property grid like this:
public enum myEnum
{
Ethernet,
Wireless,
Bluetooth
}
public class MyClass
{
public MyClass()
{
MyProperty = MyEnum.Wireless;
}
[DefaultValue(MyEnum.Wireless)]
…

new bie
- 2,745
- 6
- 24
- 26
11
votes
1 answer
How do I allow a “flag” enum to be edited in the WinForm PropertyGrid?
The WinForm PropertyGrid copes well with a standard enum but does does have a built in editor for a flag enum. Someone must have written one, I rather not reinvent the weel.
I am looking for an editor that puts a checkbox next to each member of…

Ian Ringrose
- 51,220
- 55
- 213
- 317
11
votes
4 answers
Categories are not shown in PropertyGrid for a collection, when all the properties of are read-only
As the title says, I noticed that the categories are not shown in a **PropertyGrid* (in its default collection editor) for a collection(Of T), when all the properties of class "T" are read-only.
The code below represents the code structure I…

ElektroStudios
- 19,105
- 33
- 200
- 417
10
votes
2 answers
How do I show a bool property as Yes|No in the property grid?
I know I can do this by writing custom type descriptors etc., however given how simple this requirement is; am I missing an easy way of doing it.
Being able to set the string for "true" and "false" in the BooleanConverter may be all I need, but the…

Ian Ringrose
- 51,220
- 55
- 213
- 317
10
votes
3 answers
PropertyGrid expandable collection
I want to automatically show every IList as expandable in my PropertyGrid (By "expandable", I obviously mean that the items will be shown).
I don't want to use attributes on each list (Once again, I want it to work for EVERY IList)
I tried to achive…

RE6
- 2,684
- 4
- 31
- 57
10
votes
4 answers
Property Grid Number formatting
Is it possible to format numerical properties displayed in PropertyGrid of winforms?
class MyData
{
public int MyProp {get; set;}
}
And I want it to be displayed in the grid as 1.000.000 for example.
Are there some attributes for this?

NeatNerd
- 2,305
- 3
- 26
- 49