Pre loader

Two instances of UserControl defined in creating-a-custom-scichartoverview-with-many-series-using-the-scrollbar-api share data?


I am trying out SciChart ( and WPF ) for a large dataset and till so far very pleased with the results. I have followed the example as described here and can successfully view my bound data and everything is perfect for the first instance.

However, when I assign this usercontrol to different tabs they still somehow share data about the viewstate ( the overview window does not resize, and the slider thing in front of it stays at the same values. My guess is that it has to do with the messages in ActualSizePropertyProxy , but since I am new to SciChart and WPF I was hoping that maybe someone here knows what it is.


  • You must to post comments

Hi Michael,

There is a little known ‘feature’ in WPF called TabControl virtualisation. This means if you have two tabs bound to view models, and use a DataTemplate to define your tab content, WPF virtualises and re-uses the tab content. Meaning in your case, you might have one instance of a SciChartSurface on two tabs.

Please see this stack overflow question on Why do Tab Controls Re-use View Instances when changing tabs.

You can actually disable this by using a simple converter technique. It’s worth testing the following out to see if your problem was related to Tab Control Virtualization:

public class NewViewForEachInstanceConverter : IValueConverter
    private readonly IDictionary<object, object> _views = new Dictionary<object, object>();

    public Type ViewType { get; set; }

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        if (value == null) return null;
        object view;
        _views.TryGetValue(value, out view);
        if (view != null) return view;

        view = Activator.CreateInstance(ViewType);
        _views.Add(value, view);

        return view;

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        throw new NotImplementedException();


            x:Key="NewControlForEachInstanceConverter" ViewType="{x:Type Views:SomeView}" />
    <TabControl ItemsSource="{Binding ThingsIWantToBeTabs}">
                <ContentControl Content="
                    {Binding Converter={StaticResource NewControlForEachInstanceConverter}}" />
  • You must to post comments

Thank you so much! That completely solved the problem.

Leaks won’t be a problem for me as I will have only a few open tab during the lifespan of the app so very happy with the results. Now going to try out annotations 😀

  • Andrew Burnett-Thompson
    Great, glad it helped :) most of the memory in SciChart is held in the DataSeries so unless you have hundreds or thousands of chart instances, it should be fine. Thanks!
  • You must to post comments

Binding the axis visible range in two way mode to the view model solves it completely:

            <s:DateTimeAxis AxisTitle="X" VisibleRange="{Binding XVisibleRange, Mode=TwoWay}"/>
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies