Measurement Studio for .NET Languages

取消
显示结果 
搜索替代 
您的意思是: 

Resize WPF GraphInteractionPalette

已解决!
转到解答

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

0 项奖励
1 条消息(共 5 条)
6,322 次查看
解答
已被主题作者 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 项奖励
2 条消息(共 5 条)
6,316 次查看

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 项奖励
3 条消息(共 5 条)
6,309 次查看

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 项奖励
4 条消息(共 5 条)
6,304 次查看

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 项奖励
5 条消息(共 5 条)
5,082 次查看