How can I unattach an element from another element in the XAML tree?

Posted by Edward Tanguay on Stack Overflow See other posts from Stack Overflow or by Edward Tanguay
Published on 2010-03-19T18:01:19Z Indexed on 2010/03/19 18:11 UTC
Read the original article Hit count: 239

Filed under:
|
|

In my Silverlight application, I load all the images I need at application start and store them in a dictionary.

Then as I need them I pick them out of the dictionary and attach them in XAML trees etc.

However, I have the problem that if I attach an Image object to a Grid, then want to use that image again, it tells me:

The image element is already a child of another element.

How can I run through my dictionary and "detach all images from parent XAML elements"?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about Silverlight