Pre loader

Dynamically binding overview control

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

0
0

what’s the way to bind the overview control to a chart in code?

I’m looking to add an overview control to a generic xaml chart, but only enable/bind the control when the I set the grid row visible.

I also plan to abstract the overview control into its own, freestanding control in order to bind it to the currently selected chart in a mult-chart window.

thanks in advance.

  • You must to post comments
-1
0

Hi there,

If you see our Overview Control Example you will see we use a Xaml binding to set the parent SciChartSurface:

        <sciChart:SciChartOverview Grid.Row="1" ParentSurface="{Binding ElementName=sciChart}" SelectedRange="{Binding ElementName=sciChart, Path=XAxis.VisibleRange, Mode=TwoWay}" sciChart:ThemeManager.Theme="Oscilloscope">            
        </sciChart:SciChartOverview>

The same thing can be achieved in code, simply set

var overview = new SciChartOverview();
overview.ParentSurface = sciChartSurface;
ThemeManager.SetTheme(overview, "Oscilloscope");

You will also need to set the binding from SelectedRange of OverviewControl to XAxis.VisibleRange of the SciChartSurface in code. Please see this MSDN article for guidance on setting bindings in code. The code should look something like this (I’ve not tested it)

  Binding myBinding = new Binding("XAxis.VisibleRange");
  myBinding.Source = sciChartSurface;
  overview.SetBinding(SciChartOverview.SelectedRange, myBinding);

Best regards,
Andrew

  • riverTrader
    Thanks! It is actually easier than your post. Apparently behind the scenes you do the same binding work for the range that you do for parent surface. simply: overviewChart.ParentSurface = sciChartSurface; overviewChart.SelectedRange = XVisibleRange; where overviewChart is the named overview element in the xaml view and XVisibleRange and sciChartsurface are the appropriate properties/objects in the viewModel
  • You must to post comments
Showing 1 result
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