TL;DR;
How can I add copy-paste capability to a complex, multiple values property that will enable me to copy the property value from one user control and paste it to another at design time?
The long story
I have created a user control (StylableControl
) that has a complex property called Style
.
This property contains an instance of a class called StylableControlStyles
, that contains multiple instances of a class called Style
, where each one holds values such as BackColor
, ForeColor
, Image
, Gradient
(another class I've created) etc'.
I've also created a custom control designer to allow editing style property for the user control. It shows a form where each style class in the style property can be edited easily.
Now I want to provide the users of this control an easy way to copy the entire content of the Style
property from one instance of the user control to another instance, at design time.
I could, of course, override the ToString()
method of the StylableControlStyles
object to create a string representation that will encapsulate all the data saved in this object, but that would create a hugh string and of course would need a lot of work parsing it in the class converter (currenty I'm just using an ExpandableObjectConverter
).
I would like to avoid that if possible.