Hi,
I am using MVVM pattern and want to create a user control which contains a graph control.
I want to bind my plots and axes as described in Wpf Graph Binding and defining Axes and Plots only in ViewModel.
Everything seems ok when there is a one user control on page.
When I want to put 2 user controls on a page GraphExtension class throws "Child is already registered with a IRenderableGraph'1 parent" exception on a synchronizer.SourceCollection = CollectionViewSource.GetDefaultView( e.NewValue ); line.
// Retrieve existing synchronizer, or create a new one for the target graph.
var synchronizer = (CollectionViewSynchronizer)graph.GetValue( PlotsSynchronizerProperty );
if( synchronizer == null ) {
synchronizer = new CollectionViewSynchronizer { TargetCollection = graph.Plots };
graph.SetValue( PlotsSynchronizerProperty, synchronizer );
}
// Synchronize graph's plots with new source.
synchronizer.SourceCollection = CollectionViewSource.GetDefaultView( e.NewValue );
}
How can I correct error ?
Thanks in advance
Hakan