views:

32

answers:

2

if a style is used, it can not be modified agaign. so i need a clone method. but its hard to implement.

what i want to do is implementing a cascading 'style' mechanism. for example, i set two style to the same frameworkelement. the same property of latter style will override the former one, while the different property remain unchanged. but if i set the style property of the frameworkelement twice directly, the 1st style will be gone. so i use the baseon property of style class to do that. but now come across another problem, the style can not be modified after it's been set to a frameworkelement. so now i need a clone method.

+1  A: 

Kevin,

I have written a CloneObject class which is exactly what you are looking for. Check out my code here:

"Generic class for deep clone of Silverlight and C# objects".

Jim

Jim McCurdy
A: 

thanks jim. i finally discards this 'clone' idea, because it's not that easy and seems to produce some buggy problem. so i try to create a xaml resource file, and every time i need to create a instance, i just load the xaml and call the XamlReader.load. this can bring some performance issue, but i think the cost is acceptable. and i can do styling job in blend for that specified xaml file.

Kevin Yang