Pre loader

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

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

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 http://support.scichart.com/index.php?/Knowledgebase/Article/View/17258/0/creating-a-custom-scichartoverview-with-many-series-using-the-scrollbar-api 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.

Thanks.

  • You must to post comments
2
1

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();
    }
}

Usage

<UserControl>
    <UserControl.Resources>
        <Infrastructure:NewViewForEachInstanceConverter 
            x:Key="NewControlForEachInstanceConverter" ViewType="{x:Type Views:SomeView}" />
    </UserControl.Resources>
   .....
    <TabControl ItemsSource="{Binding ThingsIWantToBeTabs}">
        <TabControl.ContentTemplate>
            <DataTemplate>
                <ContentControl Content="
                    {Binding Converter={StaticResource NewControlForEachInstanceConverter}}" />
            </DataTemplate>
        </TabControl.ContentTemplate>
    </TabControl>
</UserControl>
  • You must to post comments
0
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • 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
0
0

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

 <s:SciChartSurface.XAxis>
            <s:DateTimeAxis AxisTitle="X" VisibleRange="{Binding XVisibleRange, Mode=TwoWay}"/>
</s:SciChartSurface.XAxis>
  • 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