According to this article deep copying, I'm trying to make a deep copy of my userControl. So in my main viewModel I have:
public object Clone()
{
var cloneControl = (ISelectableViewModel) SelectedObject; //SelectedObject it's current userControl
return cloneControl.Clone();
}
My usercontrol have also simple usercontrol inside. So code for userControl Clone method is:
public override object Clone()
{
var partikel1Clone = (UserControl05Partikel1ViewModel) MemberwiseClone();
partikel1Clone.UserControl1.ViewModel = (ISelectableViewModel) UserControl1.ViewModel.Clone();
return partikel1Clone;
}
And my simple userControl's Clone method is:
public override object Clone()
{
return MemberwiseClone();
}
The problem is that my cloned object changes, when I change main object. Any ideas where am I wrong?