private void HandleMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var panelPosition = e.GetPosition(FrontPanelRuntimeOwner.GetRootPanel(Target)); // Some simple logic to see if the up is a click or the end of a drag if (_gotMouseDown && (Math.Abs(panelPosition.X - _buttonDownPanelPosition.X) < 4) && (Math.Abs(panelPosition.Y - _buttonDownPanelPosition.Y) < 4)) { // It's time to send the event _gotMouseDown = false; var position = e.GetPosition(Target.AsFrameworkElement); // Fill in the event data var nativeData = new ClickEventNativeData() { ClickCount = e.ClickCount, XPosition = position.X, YPosition = position.Y, }; // Send the event to the diagram // If you wait to be notified when the event processing is complete // you can await the call to OccurEventAsync(...) OccurEventAsync( 1, // same numeric event id that we defined in the model object for the event nativeData); // The data of the event } }
private void HandleMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { _gotMouseDown = true; _buttonDownPanelPosition = e.GetPosition(FrontPanelRuntimeOwner.GetRootPanel(Target)); }