Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect GraphInteractionPalette Click

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.

0 Kudos
Message 1 of 4
(5,534 Views)

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;
        ...
    }

~ Paul H
0 Kudos
Message 2 of 4
(5,513 Views)

Thanks, that's what I needed.

0 Kudos
Message 3 of 4
(5,507 Views)

Just wanted to let you know that Measurement Studio 2019 added the GraphInteractionPalette.InteractionSelected event to support custom handling of interaction buttons.

~ Paul H
0 Kudos
Message 4 of 4
(1,862 Views)