<p>Anybody have a good example how to deep clone a WPF object, preserving databindings?</p>

<hr>

<p>The marked answer is the first part.</p>

<p>The second part is that you have to create an ExpressionConverter and inject it into the serialization process.  Details for this are here:<br>
<a href="http://www.codeproject.com/KB/WPF/xamlwriterandbinding.aspx?fid=1428301&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=2801571" rel="noreferrer">http://www.codeproject.com/KB/WPF/xamlwriterandbinding.aspx?fid=1428301&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=2801571</a></p>

How about:
```
```
public static T DeepClone<T>(T from)
    {
        using (MemoryStream s = new MemoryStream())
        {
            BinaryFormatter f = new BinaryFormatter();
            f.Serialize(s, from);
            s.Position = 0;
            object clone = f.Deserialize(s);

            return (T)clone;
        }
    }
```
```
Of course this deep clones any object, and it might not be the fastest solution in town, but it has the least maintenance... :)