This is a migrated thread and some comments may be shown as answers.

ArguementNullException

2 Answers 59 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 28 Oct 2010, 08:00 PM
I'm playing around with radGauge and have encountered the following ArguementNullException:

System.ArgumentNullException occurred
  Message=Value cannot be null.
Parameter name: reference
  Source=PresentationCore
  ParamName=reference
  StackTrace:
       at System.Windows.Media.VisualTreeHelper.HitTest(Visual reference, Point point)
       at Telerik.Windows.Controls.Gauges.GaugeHelper.CheckPointOver(FrameworkElement element, Point point) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2_SP2\Sources\Development\Controls\Gauge\GaugeHelper.cs:line 62
  InnerException:

Here's the xaml code used to produce it.  I'm trying to have a gauge with no numerical legends or tick marks with a 360 degree sweep, going from -180 degrees to 180 degrees, with 0 at the top.

<telerik:RadGauge Name="myGauge" Style="{StaticResource gaugeRadGaugeStyle}" >
    <telerik:RadialGauge>
        <telerik:RadialScale Name="radialScale" Min="-180" Max="180" SweepAngle="360" StartAngle="90" >
            <telerik:RadialScale.Label>
                <telerik:LabelProperties Foreground="Transparent" />
            </telerik:RadialScale.Label>
            <telerik:RadialScale.Ticks>
                <telerik:TickProperties Foreground="Transparent" />
                <!--<telerik:MinorTickProperties Foreground="Transparent" />-->
            </telerik:RadialScale.Ticks>
            <telerik:RangeList>
                <telerik:RadialRange Name="SynchroscopeRange" Style="{StaticResource gaugeRadialRangeStyle}" />
            </telerik:RangeList>
            <telerik:IndicatorList>
                <telerik:Needle Name="needle" IsAnimated="true" Value="{Binding Value}"/>
            </telerik:IndicatorList>
        </telerik:RadialScale>
    </telerik:RadialGauge>
</telerik:RadGauge>

Any insight you can provide would be most appreciated!

Thanks!
Bill G

2 Answers, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 28 Oct 2010, 09:31 PM
Additional: 

This error is consistent.  The null reference exception happens every time I run in debug mode.

If is is helpful, I have a screenshot of my call stack when I get this error.  Since I couldn't paste it into the blog, it is available on my personal web server.

Thanks,
Bill Gross
0
Andrey
Telerik team
answered on 02 Nov 2010, 09:01 AM
Hi William,

The problem seems to be here:

<telerik:RadialScale.Ticks
     <telerik:TickProperties Foreground="Transparent" /> 
     <!--<telerik:MinorTickProperties Foreground="Transparent" />-->
</telerik:RadialScale.Ticks

You can't use Ticks property of the RadialScale this way, and you can't use TickProperties element in the RadialScale.Ticks list. The only elements are allowed in this list are CustomTickMark elements.

If you'd like to have gauge without legend and tick marks you should simply set MajorTicks property of the RadialScale object to -1. For example:

<telerik:RadGauge Name="myGauge" >
    <telerik:RadialGauge>
        <telerik:RadialScale Name="radialScale" 
             Min="-180" 
             Max="180" 
             SweepAngle="360" 
             StartAngle="-90" 
             MajorTicks="-1">
            <telerik:RangeList>
                <telerik:RadialRange Name="SynchroscopeRange"  />
            </telerik:RangeList>
            <telerik:IndicatorList>
                <telerik:Needle Name="needle" IsAnimated="true" Value="{Binding Value}"/>
            </telerik:IndicatorList>
        </telerik:RadialScale>
    </telerik:RadialGauge>
</telerik:RadGauge>

Greetings,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Gauges
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or