Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. PropertyGrid ...Comments plz.

PropertyGrid ...Comments plz.

Scheduled Pinned Locked Moved C#
csharpc++phpcsscom
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jay Shankar
    wrote on last edited by
    #1

    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.

    H 1 Reply Last reply
    0
    • J Jay Shankar

      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.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      A UITypeEditor won't allow you to place controls in the value region of the PropertyGrid in the .NET FCL, but it can display a popup window (like for the Control.Dock property) using the IWindowsFormsEditorService. The important thing is to read the .NET Framework SDK for the System.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 call TypeDescriptor.GetProperties. This even allows you to filter the properties with an array of attributes. You could, for example, pass an instance of the BrowsableAttribute(false) as one of the elements in the Attribute[] 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 the IWindowsFormsEditorService and other services that support UITypeEditors. You should also examine how the System.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 the PropertyGrid itself. Once you dig into the managed implementation for the PropertyGrid, 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

      J 1 Reply Last reply
      0
      • H Heath Stewart

        A UITypeEditor won't allow you to place controls in the value region of the PropertyGrid in the .NET FCL, but it can display a popup window (like for the Control.Dock property) using the IWindowsFormsEditorService. The important thing is to read the .NET Framework SDK for the System.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 call TypeDescriptor.GetProperties. This even allows you to filter the properties with an array of attributes. You could, for example, pass an instance of the BrowsableAttribute(false) as one of the elements in the Attribute[] 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 the IWindowsFormsEditorService and other services that support UITypeEditors. You should also examine how the System.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 the PropertyGrid itself. Once you dig into the managed implementation for the PropertyGrid, 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

        J Offline
        J Offline
        Jay Shankar
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • J Jay Shankar

          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.

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          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.

          top secret AdvancedTextBox

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups