如何在Silverlight中克隆UIElement [英] How to Clone UIElement in Silverlight

查看:112
本文介绍了如何在Silverlight中克隆UIElement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我如何在 SILVERLIGHT 克隆UIElement吗?我在google中挖了很多但是我无法找到相关的解决方案,无处不在我只是在WPF中获得克隆UIElement的解决方案,但同样不适用于Silverlight。



每次点击一个+按钮,我需要在同一个网格的下一行添加一个UIElement。



Plz help ..没有回答值得赞赏



谢谢GK

Can anybody tell me how to clone UIElement in SILVERLIGHT ? I dug a lot in the google but I'm not able to find relevant solution, everywhere I'm just getting solution to clone UIElement in WPF, however same is not applicable in the Silverlight.

I need to add the a UIElement in the same grid's next rows on click of a + button eachtime.

Plz help..any answer will be appreciable

Thanks GK

推荐答案

请参阅我对答案的评论。对于简单的浅层克隆,您始终可以使用 System.Object.MemberwiseClone

http://msdn.microsoft.com/en-us/library/system.object.memberwiseclone%28v=vs。 110%29.aspx [ ^ ]。



克隆后,您可能需要调整某些属性,因为定期克隆会导致不必有效。



没有一个普遍的深度克隆。对于一些解决方法,请参阅我过去的答案:如何为List Class实现ICloneable? [ ^ ]。



在此页面上查看其他两个答案,仅供参考: 如何为列表类实现ICloneable? [ ^ ]。



-SA
Please see my comment to the answer. For simple shallow cloning, you can always use System.Object.MemberwiseClone:
http://msdn.microsoft.com/en-us/library/system.object.memberwiseclone%28v=vs.110%29.aspx[^].

After cloning, you may need to adjust certain property, as the result of regular cloning does not have to be valid.

There are no one universal deep cloning. For some work-around approach, please see my past answer: How to implement ICloneable for a List Class?[^].

See other two answers on this page, just for some background: How to implement ICloneable for a List Class?[^].

—SA


这篇关于如何在Silverlight中克隆UIElement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆