PropertyGrid ...Comments plz.
-
Dear CPians, I have been assigned to develop a Custom PropertyGrid with look and fill like the link below. http://www.visualhint.com/feature5.php In the PropertyGrid value cells, I am assigned to display the controls like NumericUpDown, RadioButtons, CheckBox, ListBox etc.I read several articles both in CP and MSDN and gathered the following informations. I request the CPians to comment on the below points(point 1 to point 3) 1.It is not possible to host a control in the value area of the PropertyGrid. It is however possible to draw the control in that area if we have the correct UITypeEditor. 2.The thumbnail of images can be displayed next to image data in the property grid. (Displaying control in the complete cell area is not possible[Actually I wanted to display NumericUPDown control in the cell]) 3.There is no "official/documented" way to customize that error box. PropertyGrid component displays the error in its own dialog. Information Required: 4.Considering the above facts, I wanted to go for some third party tool which gives the similar facilities and can be used as a control component in the project that is using C#.Net as development environment. But I did not get any. All the components are written using MFC unmanaged code. I want the component, written in mananaged environment, so that I can use it in C#.net development environment with ease. I request the CPians to share the information in this regard, if you know any such components. Thanks in advance. Regards, Jay.
-
Dear CPians, I have been assigned to develop a Custom PropertyGrid with look and fill like the link below. http://www.visualhint.com/feature5.php In the PropertyGrid value cells, I am assigned to display the controls like NumericUpDown, RadioButtons, CheckBox, ListBox etc.I read several articles both in CP and MSDN and gathered the following informations. I request the CPians to comment on the below points(point 1 to point 3) 1.It is not possible to host a control in the value area of the PropertyGrid. It is however possible to draw the control in that area if we have the correct UITypeEditor. 2.The thumbnail of images can be displayed next to image data in the property grid. (Displaying control in the complete cell area is not possible[Actually I wanted to display NumericUPDown control in the cell]) 3.There is no "official/documented" way to customize that error box. PropertyGrid component displays the error in its own dialog. Information Required: 4.Considering the above facts, I wanted to go for some third party tool which gives the similar facilities and can be used as a control component in the project that is using C#.Net as development environment. But I did not get any. All the components are written using MFC unmanaged code. I want the component, written in mananaged environment, so that I can use it in C#.net development environment with ease. I request the CPians to share the information in this regard, if you know any such components. Thanks in advance. Regards, Jay.
A
UITypeEditor
won't allow you to place controls in the value region of thePropertyGrid
in the .NET FCL, but it can display a popup window (like for theControl.Dock
property) using theIWindowsFormsEditorService
. The important thing is to read the .NET Framework SDK for theSystem.ComponentModel
namespace, and remember that it doesn't matter what language you write this in. All languages targeting the CLR compile to IL, so you can write this in C# and use it for VB.NET, Perl.NET, and many others. For example, to get the collection of properties, you'd callTypeDescriptor.GetProperties
. This even allows you to filter the properties with an array of attributes. You could, for example, pass an instance of theBrowsableAttribute(false)
as one of the elements in theAttribute[]
array so that non-browsable properties are not displayed (default behavior). The .NET component model provides pretty much all the services you need. You should also implement certain services like theIWindowsFormsEditorService
and other services that supportUITypeEditor
s. You should also examine how theSystem.Windows.Forms.PropertyGrid
currently works either by using ildasm.exe (the IL Disassembler, part of the .NET Framework SDK, if you know how to read IL), or a decent decompiler like .NET Reflector[^]. You might also consider comprimising on a few things, like being able to host a control inside thePropertyGrid
itself. Once you dig into the managed implementation for thePropertyGrid
, you'll find it's not so easy doing the correct way (using the component model, which is still the easiest way).Microsoft MVP, Visual C# My Articles
-
A
UITypeEditor
won't allow you to place controls in the value region of thePropertyGrid
in the .NET FCL, but it can display a popup window (like for theControl.Dock
property) using theIWindowsFormsEditorService
. The important thing is to read the .NET Framework SDK for theSystem.ComponentModel
namespace, and remember that it doesn't matter what language you write this in. All languages targeting the CLR compile to IL, so you can write this in C# and use it for VB.NET, Perl.NET, and many others. For example, to get the collection of properties, you'd callTypeDescriptor.GetProperties
. This even allows you to filter the properties with an array of attributes. You could, for example, pass an instance of theBrowsableAttribute(false)
as one of the elements in theAttribute[]
array so that non-browsable properties are not displayed (default behavior). The .NET component model provides pretty much all the services you need. You should also implement certain services like theIWindowsFormsEditorService
and other services that supportUITypeEditor
s. You should also examine how theSystem.Windows.Forms.PropertyGrid
currently works either by using ildasm.exe (the IL Disassembler, part of the .NET Framework SDK, if you know how to read IL), or a decent decompiler like .NET Reflector[^]. You might also consider comprimising on a few things, like being able to host a control inside thePropertyGrid
itself. Once you dig into the managed implementation for thePropertyGrid
, you'll find it's not so easy doing the correct way (using the component model, which is still the easiest way).Microsoft MVP, Visual C# My Articles
Hi Heath, Rather than going for managed implementation for the PropertyGrid, I think I should compromise the following : 1.Hosting the control inside the PropertyGird value cell. 2.Customizing the error dialog box of the PropertyGrid Control. I will put forward this to our management, since our main focus is not of component development. Thanks once again for your valuable suggestion. Best Regards, Jay.
-
Hi Heath, Rather than going for managed implementation for the PropertyGrid, I think I should compromise the following : 1.Hosting the control inside the PropertyGird value cell. 2.Customizing the error dialog box of the PropertyGrid Control. I will put forward this to our management, since our main focus is not of component development. Thanks once again for your valuable suggestion. Best Regards, Jay.
I have done something like this, but I tackled it from the other side. I basically recreated the PropertyGrid's behaviour in my own control, and let the editors/convertors do there work.