05-29-2014 10:05 AM
Is it possible to resize a WPF GraphInteractionPalette to make the icons appear larger? If so, how?
Solved! Go to Solution.
05-29-2014 01:50 PM
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 ) );
}
}
05-29-2014 04:14 PM
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?
05-29-2014 04:28 PM
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).
08-11-2015 01:04 PM
Just wanted to let you know we have added the ButtonSize
property to the graph interaction palette in the Measurement Studio 2015 release.