Pre loader

Rollover modifier binding doesn't work

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

Hi,
In the RolloverModifier sample (enclosed)the values of both data series are displayed in the custom ItemsControl with corresponding SeriesInfo template, see the attached project for details. If I want to add another ChartModifier I have to add a SciChart:ModifierGroup, see xaml below:

        <SciChart:SciChartSurface.ChartModifier>
          <SciChart:ModifierGroup>    
            <SciChart:RolloverModifier />
           </SciChart:ModifierGroup> 
        </SciChart:SciChartSurface.ChartModifier>

If I do these changes the values of both data series are not displayed in the ItemsControl any more.
Is there a fix for this ??

Attachments
  • You must to post comments
0
0

Hi Andreas,

Thank you for the solution to reproduce. I’ve just taken a look – since you have moved the RolloverModifier inside a ModifierGroup, you need to change a binding on the ItemsControl that reads out the rollover values.

The RolloverModifier is just a data-source. You can treat it as a sort of ViewModel in the MVVM sense. It exposes a collection of SeriesInfo objects which you can consume anywhere in your app.

In our RolloverModifier example, the SeriesInfo objects are consumed by an ItemsControl with this binding:

 <!--  Define an area in the top left of the chart which binds to the RolloverModifier.RolloverData.SeriesInfo collection  -->
        <!--  Each SeriesInfo contains information such as SeriesName, Color and Data Value at the mouse location  -->
        <!--  This collection updates dynamically as the mouse is moved. We bind to it using an ItemsControl so if more series are  -->
        <!--  added then the feedback also updates  -->
        <ItemsControl Margin="23,23"
                      HorizontalAlignment="Left"
                      VerticalAlignment="Top"
                      Background="#77FFFFFF"
                      BorderBrush="#55000000"
                      BorderThickness="2"
                      Grid.IsSharedSizeScope="True"
                      ItemsSource="{Binding ChartModifier.SeriesData.SeriesInfo,
                                            ElementName=sciChartSurface}"
                      Padding="5">
                      ... 

Since you have moved the RolloverModifier inside a ModifierGroup, the binding will no longer work (check your Visual Studio output window for binding errors, it will be there).

So, change it to this and it will work

<!--  Defines the RolloverModifier, which provides mouse-move feedback of underlying datapoints  -->
            <SciChart:SciChartSurface.ChartModifier>
              <SciChart:ModifierGroup>    
                <SciChart:RolloverModifier x:Name="rolloverModifier"/> <!-- Name the rollovermodifier -->
               </SciChart:ModifierGroup> 
            </SciChart:SciChartSurface.ChartModifier>

          ... 


         <!-- Bind to the RolloverModifier.SeriesData by name -->

        <ItemsControl Margin="23,23"
                      HorizontalAlignment="Left"
                      VerticalAlignment="Top"
                      Background="#77FFFFFF"
                      BorderBrush="#55000000"
                      BorderThickness="2"
                      Grid.IsSharedSizeScope="True"
                      ItemsSource="{Binding SeriesData.SeriesInfo,
                                            ElementName=rolloverModifier}"

Best regards,
Andrew

  • 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