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.
- Kwokon Ng asked 9 years ago
- You must login to post comments
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.
- Kwokon Ng answered 9 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 9 years ago
- 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 login to post comments
Please login first to submit.