07-31-2013 04:11 AM
Hi
I am trying out the GaugeDouble wpf control. For the winforms control there is a RangeFills property. Is there a similar property for the GaugeDouble wpf control?
Kind regards
/Axel
Solved! Go to Solution.
07-31-2013 10:54 AM
The short answer is that there is no direct feature equivalent to the RangeFills
property in Windows Forms, but you can mimic the effect with careful use of some primitive types:
<ni:GaugeDouble>
<ni:GaugeDouble.TrackDecorations>
<niPrimitives:RegionFigure ZIndex="-10"
RelativeWidth="0.4"
RelativeHeight="0.08"
RelativeVerticalPosition="1.022"
RelativeVerticalAlignment="Far"
Fill="LimeGreen" />
</ni:GaugeDouble.TrackDecorations>
</ni:GaugeDouble>
The longer answer is that, for the first version of the WPF controls, we intentionally left many of the underlying primitive types with minimal documentation, as we may change them in the future. In the current implementation, we use RegionPanel
and attached properties like RelativeHorizontalAlignment
to perform the layout for many of our controls. Although these exact members may be removed in a later release, we do plan to provide equivalent functionality and stabilize the primitive API over time.
Besides that caveat, I hope you find this useful.
08-01-2013 01:08 AM
Thank you for the answer. Just one more thing: my xaml file does not accept "niPrimitives:RegionFigure". What references/namespaces is required in my file? I am using version 13.0.45.242 of NationalInstruments.Controls
/Axel
08-01-2013 09:41 AM
Here are the XML namespaces for the WPF controls:
xmlns:ni="http://schemas.ni.com/controls/2009/xaml/presentation"
xmlns:niPrimitives="http://schemas.ni.com/controls/2009/xaml/presentation/primitives"
01-22-2014 06:37 AM
Hi,
what i have to do if i want the Fillrange from 4 to 8 for example ?
01-23-2014 12:51 AM
Try this :
Dim o AsNew NationalInstruments.Controls.Primitives.Regions.RegionFigure
o.ZIndex = -10
o.RelativeHeight = 0.08
o.RelativeVerticalPosition = 1.022
o.RelativeVerticalAlignment =RelativeAlignment.Far
o.Fill =Brushes.LimeGreen
o.RelativeHorizontalPosition = (LowerLimit - LowerRange) / (UpperRange - LowerRange)'start
o.RelativeWidth = (UpperLimit - LowerLimit) / (UpperRange - LowerRange)'length
g.TrackDecorations.Add(o)
03-23-2016 09:41 AM
Hi,
Sorry for my poor english!
Where find i the RegionFigure in version 15.0.45.3898 of NationalInstruments.Controls?
I was looking for this in the NationalInstruments.Controls.Primitives in ObjectBrowser, but not containing this.
Or where is the problem?
(Visual Studio 2013 Community UPD 5, MeasurementStudio 2015 Standard, .NET4.5 WPF application)
Regards,
Tamas
03-23-2016 10:27 AM
You are not missing anything: the "region" types from the initial release of the Measurement Studio WPF controls were replaced by "relative" types, to fix several layout performance issues.
To achieve the same effect in the latest version of Measurement Studio, you can use some of the new "relative" types:
<ni:GaugeDouble>
<ni:GaugeDouble.TrackDecorations>
<niPrimitives:RelativeRadialScalePanel
niPrimitives:RelativeRadialHostPanel.Edge="Inside"
niPrimitives:RelativePanel.RelativeWidth="1.0"
niPrimitives:RelativePanel.RelativeHeight="1.0"
niPrimitives:RelativePanel.RelativeHorizontalPosition="0.5"
niPrimitives:RelativePanel.RelativeHorizontalAlignment="Center"
ArcSweep="{Binding ScaleArc, RelativeSource={RelativeSource AncestorType=ni:GaugeDouble}}"
>
<niPrimitives:Baseline
RelativeLength="0.4"
Stroke="LimeGreen"
StrokeThickness="5"
StrokeEndLineCap="Flat"
StrokeStartLineCap="Flat"
/>
</niPrimitives:RelativeRadialScalePanel>
</ni:GaugeDouble.TrackDecorations>
</ni:GaugeDouble>
03-23-2016 10:45 AM
Many thanks!!!! Work perfectly!
Regards,
Tamas