Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

WPF GaugeDouble RangeFill

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 9
(7,370 Views)
Solution
Accepted by AxelHaraldsson

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>

GaugeWithDecoration.png

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.

~ Paul H
0 Kudos
Message 2 of 9
(7,359 Views)

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

0 Kudos
Message 3 of 9
(7,348 Views)

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"

~ Paul H
0 Kudos
Message 4 of 9
(7,340 Views)

Hi,

what i have to do if i want the Fillrange from 4 to 8 for example ?

0 Kudos
Message 5 of 9
(7,048 Views)

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)

 

0 Kudos
Message 6 of 9
(7,039 Views)

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

0 Kudos
Message 7 of 9
(5,062 Views)

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>

~ Paul H
Message 8 of 9
(5,046 Views)

Many thanks!!!! Work perfectly! 

 

Regards,

Tamas

0 Kudos
Message 9 of 9
(5,040 Views)