Custom user controls - how to add Code Collection Editor of type Dictionary<int, Color>
I am fairly familiar with creating simple custom controls, but I haven't had this instance come up before, I wish to give design time changeability support to a "Colors" dictionary which applies a series of gradients to a custom control panel.
Although using a simple public Dictionary<int, C开发者_JAVA技巧olor> ProgressValueColors
does in fact give me the design-time property in my Properties window with the "..." selection, it is completely greyed out, it must not automatically infer my Dictionary and know what to do, both Add and Remove buttons are greyed out, see below. How could I make this function?
I will need to enter a "Value" property which is the Key
of the int, and a Color property which needs to be a color picker and then the user can press Add to have this add to the Dictionary.
Thanks, hope there is some user control expert out there! :)
Check this thread out here - the gist is that you would need to create a CollectionEditor or UITypeEditor subclass.
精彩评论