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

BulletGraph setting AdditionalComparativeMeasures Value in code behind

3 Answers 55 Views
BulletGraph
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick
Top achievements
Rank 2
Nick asked on 19 Feb 2013, 07:47 AM
Hello,

I have the following XAML:
<telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>
    <telerikDataVisualization:BulletGraphComparativeMeasure x:Name="BGCM9" Value="2.5"
                                            Template="{StaticResource BulletGraphAdornerTemplate}"/>
</telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>

And I figured that in the code behind, I would be able to set the value as follows:

BGCM9.Value = 0;


But when I run it, I get the following error:
An exception of type 'System.NullReferenceException' occurred in sstimer.DLL but was not handled in user code where sstimer is my app.

No matter what value I pick, I get the same error. Can someone point me in the right direction here?

Thanks,
Nick

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 19 Feb 2013, 09:53 AM
Hi Nick,

Thanks for writing.
This is a known bug in the Silverlight framework. RadChart also suffers from it. You can find an explanation here. Basically, you need to iterate through the additional comparative measures to find your object. 

All the best,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Nick
Top achievements
Rank 2
answered on 19 Feb 2013, 01:40 PM
I have been searching high and low for examples on how I can achieve this, but I cannot... Have you any other suggestions?

<telerikDataVisualization:RadBulletGraph x:Name="RBGSummary" Grid.Row="1"
                         Height="70"
                         LabelTemplate="{StaticResource BulletGraphLabelTemplate}"
                         TickTemplate="{StaticResource BulletGraphTickTemplate}"
                         TickStep="1"
                         LabelStep=".5"
                         StartValue=".5"
                         EndValue="5"
                         LabelOffset="12"
                         Margin="12,15,12,0"
                         ComparativeMeasure="4.25"
                         FeaturedMeasureBrush="{StaticResource PhoneForegroundBrush}"
                         FeaturedMeasureAlternativeTemplate="{StaticResource FeaturedMeasureAlternativeTemplate}"
                         FeaturedMeasure="2"
                         FeaturedMeasureThickness="6"
                         ComparativeMeasureTemplate="{StaticResource BulletGraphComparativeMeasureTemplate}">
 
    <telerikDataVisualization:RadBulletGraph.QualitativeRanges>
        <telerikDataVisualization:BarIndicatorSegment Stroke="{StaticResource CriticalBrush}"
                                      Thickness="23"/>
        <telerikDataVisualization:BarIndicatorSegment Stroke="{StaticResource SatisfactoryBrush}"
                                      Thickness="23"/>
        <telerikDataVisualization:BarIndicatorSegment Stroke="{StaticResource GoodBrush}"
                                      Thickness="23"
                                      Length=".25"/>
    </telerikDataVisualization:RadBulletGraph.QualitativeRanges>
 
    <telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>
        <telerikDataVisualization:BulletGraphComparativeMeasure Value="2.7"
                                                Template="{StaticResource BulletGraphAdornerTemplate}"/>
        <!--<telerikDataVisualization:BulletGraphComparativeMeasure Value="3.7"
                                                Template="{StaticResource BulletGraphAdornerTemplate}"/>-->
    </telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>
</telerikDataVisualization:RadBulletGraph>

I am trying to set that value of 2.7 to what I want in the code behind.

Thanks,
0
Victor
Telerik team
answered on 19 Feb 2013, 04:39 PM
Hi Nick,

Here is an example of how you can set the value of any additional comparative measure:

BulletGraphComparativeMeasure BGCM9 = bulletGraph.AdditionalComparativeMeasures.Single<BulletGraphComparativeMeasure>((measure) => measure.Name == "BGCM9");
BGCM9.Value = 0;

Please note that you need to add using System.Linq; to the beginning of your source file so that you can take advantage of the Single<> extension method. The other approach would be to iterate of the the collection and compare all measures manually.All the best,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
BulletGraph
Asked by
Nick
Top achievements
Rank 2
Answers by
Victor
Telerik team
Nick
Top achievements
Rank 2
Share this question
or