dynamic creation gauges

Gauge for WPF Forum

Posted 10 years ago by RDR
Avatar
Hi,


I try to create dynamicaly a linear gauge without using xaml.
1- Have you got any piece of code that show how to do it? What are the minimum default properties to set?
2- How can I change or modify the default Linear Gauge's control template ?

Thanks,

Best regards

Comments (1)

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

1. We don't currently have any samples that build a gauge in the code-behind, but converting from the XAML representation to the C#/VB.Net is fairly trivial. Some common gotchas are:
- XAML supports a default "content" property, which it uses when not XML element property is specified. But you can use reflector to discover the "content" property, or just ask us.
- XAML uses type converters to make setting things easier. For example, the gauge controls make extensive use of the Unit type (from our Shared Library), which allows sizes to be specified using absolute pixels or percentages. So in XAML you could type "10%", but in C# you would need to use "Unit.Percentage(10)" to set say the CircularPointerNeedle.PointerExtent property. Again, you could use Reflector or ask us if you run into any issues.

2. The gauge controls don't use control templates, as everything is custom rendered. So you can't change or modify it. Instead, you add or remove various elements (pointers, ranges, scales, etc.) to achieve the look you want.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.