06-26-2013 11:41 AM
Hello,
I'm wondering if there is a way to detect when a GraphInteractionPalette button is clicked. I tried attaching a MouseDown/MouseUp event handler to the GraphInteractionPalette but that did not fire, I'm guessing because I would need to add the event handler to the actual button inside the palette.
Ideally I could detect which button on the palette was clicked, e.g. ZoomToFit.
Thanks in advance.
06-27-2013 10:20 AM
Buttons handle the MouseDown
and MouseUp
events itself, which you can see by attaching the events to a stand-alone button outside of any other control. From these events, it raises the Click
routed event, which you can listen to on the interaction palette:
<ni:GraphInteractionPalette Button.Click="OnButtonClicked" />
The content of the clicked button will be the associated graph interaction (or a string for the "zoom to fit" option):
private void OnButtonClicked( object sender, RoutedEventArgs e ) {
var button = e.OriginalSource as ButtonBase;
var interaction = button != null ? button.Content as GraphInteraction : null;
...
}
06-27-2013 01:43 PM
Thanks, that's what I needed.
07-08-2019 03:00 PM
Just wanted to let you know that Measurement Studio 2019 added the GraphInteractionPalette.InteractionSelected
event to support custom handling of interaction buttons.