Pre loader

How to avoid SciChartSurface Consuming Mouse Event?

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

Answered
0
0

I have a ListBox containing ListBoxItems that are UserControls containing a SciChartSurface.

My user needs to be able to select an item in the ListBox. I find that if you click on the SciChartSurface, the item does not get selected. I had to click outside the SciChartSurface to select the ListBoxItem.

Is there an easy way to make SciChartSurface not consume the mouse event? The user will not be manipulating anything in the SciChartSurface so there is no need for it to handle any mouse events.

Thank you.

  • You must to post comments
Good Answer
0
0

I looked at SciChart example [Create Multiseries Charts]=>[Dashboard Style Charts].

It appears (I tried it out and it worked) that putting the SciChartSurface inside a Grid and adding a Border as the last item in the Grid makes the ListBoxItem selectable when clicking on the chart surface.

Sandbox code attached in zip file.

  • You must to post comments
0
0

Hi there,

Do you have any ChartModifiers registered on the SciChartSurface? If there are no ChartModifiers (RubberBandXyZoomModifier, ZoomExtentsModifier) then mouse events will not be handled.

The other thing is that sometimes in WPF elements don’t report mouse events if the background is null. e.g. consider this:

<!-- Clicking the grid does not raise a mouse event -->
<Grid>
   <!-- ... -->
</Grid>

vs

<!-- Clicking the grid does raise a mouse event -->
<Grid Background="Transparent">
   <!-- ... -->
</Grid>

Best regards,
Andrew

  • Kwokon Ng
    No ChartModifiers at all. See, in attached sandbox code, the file ListBoxItemUserControl.xaml. If you comment out the Border block, clicking the chart will not select the item. Uncomment it and it works again. Making grid background “Transparent” or “White” does not work either if Border block is not there. Note, when testing you have to click on the inside of the chart (where the plot lines will be). The problem does not show up if you click on the axes.
  • You must to post comments
Showing 2 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