Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Resize WPF GraphInteractionPalette

Solved!
Go to solution

Is it possible to resize a WPF GraphInteractionPalette to make the icons appear larger? If so, how?

0 Kudos
Message 1 of 5
(5,653 Views)
Solution
Accepted by mhelm

There is no property to customize the size of the buttons in the interaction palette.


As a workaround, you can use the example Loaded event handler below to walk the visual tree and resize the buttons. (Note that the buttons currently use image resources for the icons, which may not look good at larger sizes.)


    private void OnInteractionPaletteLoaded( object sender, RoutedEventArgs e ) {
        var palette = (GraphInteractionPalette)sender;
        ResizeButtons( palette );
    }

    private static void ResizeButtons( DependencyObject d ) {
        var button = d as ButtonBase;
        if( button != null ) {
            button.Width *= 2;
            button.Height *= 2;
        }
        else {
            int childCount = VisualTreeHelper.GetChildrenCount( d );
            for( int i = 0; i < childCount; ++i )
                ResizeButtons( VisualTreeHelper.GetChild( d, i ) );
        }
    }

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

That worked perfectly, thank you!

 

You're right, the images look a bit grainy when doubled in size. If I had my own images, could I use those instead?

0 Kudos
Message 3 of 5
(5,640 Views)

The palette uses the Content of the buttons to determine which interaction to activate, but you can set the ContentTemplate to a custom value while visiting each button to display your own images (or create a new control template to customize the buttons).

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

Just wanted to let you know we have added the ButtonSize property to the graph interaction palette in the Measurement Studio 2015 release.

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