I'm replacing my property grid with something that will allow me to customize my UI a bit better. I placed a button on my form that I hope when clicked would pop up a CollectionEditor and allow me to modify my code. When I was using the PropertyGrid, all I needed to do was add some attributes to the property pointing to my CollectionEditor and it worked. But how do I invoke the CollectionEditor manually? Thanks!
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Found the answer here: http://www.devnewsgroups.net/windowsforms/t11948-collectioneditor.aspx
Just in case the site linked above goes away some day, here's the gist of it. The code is verbatim from the link above, however; the comments are mine.
Assume you have a form with a ListBox and a button. If you wanted to edit the items in the ListBox using the CollectionEditor, you would do the following in your EventHandler:
Now the next thing you need to do is to create the RuntimeServiceProvider(). This is the code the poster in the link above wrote to implement this:
Since I can't comment i'll post this here:
You can get the DialogResult by adding a Click event on the okButton of the CollectionEditor in WindowsFormsEditorService.ShowDialog
...