I'm trying to clone UIElement. Everything seems to be ok, but my DependencyProperties also copy to a new element as in:

var newEl = new MyElement();

And because one of my DependencyProperties is also a UIElement and it's already bound onto window error occurs that element is already in use. So I even can't create new element.

What is the problem?

有帮助吗?

解决方案

Ok, the only solving that I've found is to remove DependencyProperty and create a normal Property for my ObservateCollection<UIElement> and use INotifyPropertyChanged.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top