Resizing a Gauge in a panel

Gauge for WPF Forum

Posted 10 years ago by Cameron MacFarland - Senior Software Engineer, Orelogy Geotechnical
Version: 4.5.0477
Avatar
Is there a way to resize a gauge so it fills the panel it's in?

Specifically I have a single CircularGauge in a ToolWindow and I want the gauge to resize when the toolwindow does.

Thanks
Cameron

Comments (6)

Posted 10 years ago by D
Avatar
I would be interested in the answer, since I'll be doing this eventually with the gauges that I'm creating.

From what I've seen so far, the "Dynamic Sizing QuickStart" in the Actipro samplebrowser may be a good starting point for this question. It may not be the exact answer that you're looking for, but hopefully someone from Actipro will chime in with more information if you're still stuck.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Cameron,

D is correct, the "Dynamic Resizing" QuickStart shows how the gauge controls can be resized. This functionality was introduced in version 4.5.0480 of WPF Studio. More information can be found in this blog post.

When defining the elements of the gauge, you would need to use percentages, instead of hard-coded pixel sizes. Several properties, such as ScaleOffset and PointerExtent, are actually of type Unit, not double. Unit supports percentage based sizes, which the gauges can then use to calculate the actual pixel size based on it's current size.

If you have any problems, please email over a sample project to our support address and we can take a look.


Actipro Software Support

Posted 10 years ago by Cameron MacFarland - Senior Software Engineer, Orelogy Geotechnical
Avatar
Well upgrading got me most of the way there, but I'm still having issues scaling offset gauges and items on the gauge.

Basically I'm trying to make a scalable version of the Tachometer from the automotive sample.

Any suggestions?
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I changed the type of the X and Y attached properites from a double to a Unit, which allows percentages to be used. Additionally, I've added a MultiplicationConverter to the Shared Library and UnitBaseX/UnitBaseY properties to GaugeBase (the base class of all the gauge controls). Using these, you can bind the FontSize of the TextBlock using a percentage of the UnitBaseX or UnitBaseY.

For the CircularGauge, these two values would be the same (based on the Radius). I also updated our Dynamic Resizing QuickStart to show how this is done.

This will all be available in the next maintenance release.


Actipro Software Support

Posted 5 years ago by 7Alpha7
Avatar

Hello,

could you post an example of how to use it ?

I have an embeded digital gauge in a circular gauge and I tried something like :

<gauge:DigitalGauge x:Name="digitalGauge" 
                                Width="{Binding Path=UnitBaseX, ElementName=gauge, Converter={StaticResource MultiplicationConverter}, ConverterParameter=20%}" 
                                Height="{Binding Path=UnitBaseY, ElementName=gauge, Converter={StaticResource MultiplicationConverter}, ConverterParameter=5%}"/> 

 but it doesn't work. I dont know WPF very much and I always spend hours to fix stupid things like this.

Thank you.

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello, if you'd like us to look at something, please make a new simple sample project that shows what you are trying to achieve and we can check that out.  Please send that over to our support address, be sure to rename the .zip file extension so it doesn't get spam blocked, and include details on what you are looking to do.  Thanks!


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 12 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.