chugathon

Author Topic: How to use DateTimePicker control in Property Grid using TypeConverter class?  (Read 202 times)

Offline nav_indian

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Hello,

https://docs.microsoft.com/en-gb/previous-versions/visualstudio/visual-studio-2013/ayybcxe5(v=vs.120)#type-converters-that-provide-a-list-of-standard-values-to-a-properties-window
https://www.cyotek.com/blog/creating-a-custom-typeconverter-part-1
https://www.cyotek.com/blog/creating-a-custom-typeconverter-part-2
https://www.cyotek.com/blog/creating-a-custom-type-converter-part-3-types-to-string

I am trying to use a .Net control such as DateTimePicker (or some customization of it) inside a Property Grid. It would probably need a custom type converter and custom UITypeEditor control etc.

I checked the above links on MSDN and on cryotek website. There were examples of how to write a simple PickList that gets populated (by overriding GetStandardValues() in your TypeConverter class etc) at runtime inside the Property Grid. But there was no example of how to implement a complicated control such as a DateTimePicker being implemented in the Property Grid. My application requires user to select date, time and (if possible) timezone from the Property Grid.

It should look like a string initially e.g. "2018-03-07 02:00:00 -04:30" and then user clicks on the drop-down arrow and the GUI control such as DateTimePicker should spring into action. User will make the necessary edits and then the DateTimePicker control will collapse and the string in the property grid will be updated to something like: "2018-03-07 05:30:00 -04:30".

I am a .Net newbie and if I can get some sample code or examples or help/guidance in this, it will be of great help to me. Basically our application is all VC++ but uses a .Net property grid and type converters etc for one of the pages in our GUI.

Thanks in advance.

Kind Regards,
Naveen

 

anything