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)
{
}
- Daniel Hartl asked 10 years ago
- last edited 10 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
Please login first to submit.