SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

I want to implement a PopUpWindowAction and InteractionRequestTrigger via the Micrsoft PRISM Libray:
But it starts with basic problems:
I’m not able to create a correct invokeCommandAction, the RaisItemSelection method gets never executed?

Xaml:

<s:SciChartSurface>
  <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <i:InvokeCommandAction Command="{Binding MouseDoubleClickCommand}" CommandParameter="{}" />
                </i:EventTrigger>
    </i:Interaction.Triggers>
</<s:SciChartSurface>

xaml.cs:

MouseDoubleClickCommand = new DelegateCommand<object>(RaiseItemSelection);
 private void RaiseItemSelection(object obj)
        {
        }
  • You must to post comments
0
0

Ok, my guess would be that you are also using the ZoomExtentsModifier. If so, this will set e.Handled=True on the MouseDoubleClick event on the chart.

Another way to handle this is to create a custom modifier. Sounds a bit farfetched, but if you want full event support and manipulation of the chart, modifiers are the way to go. See our series on Custom ChartModifiers here. For instance, something like this would handle the event off the chart, and also allow forwarding on to ViewModel.

public class DoubleClickModifier : ChartModifierBase
{
    public event EventHandler<EventArgs> ChartDoubleClick;

    public override void OnModifierDoubleClick(ModifierMouseArgs e)
    {
        base.OnModifierDoubleClick(e);

        var handler = ChartDoubleClick;
        if (handler != null)
        {
            handler(this.ParentSurface, EventArgs.Empty);
            e.Handled = true; // NOTE this will prevent double click going to modifiers lower down in the stack
        }
    }
}

Something like that, you could insert this modifier into the SciChartSurface.ChartModifier property (or inside a modifier group) and use it to redirect events to your view model via EventToCommand.

Hope this helps,

Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.