I have a BulletGraph in a UserControl, and I'm trying to bind the values of the qualitative ranges to values in my ViewModel. I can bind maximum, featured, comparative, projected, minimum, and so on. But adding bound values to qualitative ranges generates an exception.
My XAML code:
The values are all doubles, as here:
And the exception thrown:
When I run the application, the BulletGraph simply doesn't appear. Is there a better way to add qualitative ranges with bound values?
-Jonathan
My XAML code:
<
sdk:Page
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local
=
"clr-namespace:Report_Templates"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
x:Class
=
"Report_Templates.Bullet_View"
Title
=
"Bullet_View Page"
d:DesignWidth
=
"800"
d:DesignHeight
=
"600"
>
<
UserControl.DataContext
>
<
local:MainViewModel
/>
</
UserControl.DataContext
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerik:RadHorizontalBulletGraph
Grid.Row
=
"1"
Minimum
=
"0"
Maximum
=
"{Binding BulletAggregators[0].High}"
FeaturedMeasure
=
"{Binding BulletAggregators[0].Actual}"
ComparativeMeasure
=
"{Binding BulletAggregators[0].Goal}"
Width
=
"450"
Height
=
"50"
>
<
telerik:RadBulletGraphBase.QualitativeRanges
>
<
telerik:QualitativeRange
Brush
=
"Red"
Value
=
"{Binding BulletAggregators[0].Median}"
/>
<
telerik:QualitativeRange
Brush
=
"Yellow"
Value
=
"{Binding BulletAggregators[0].Mean}"
/>
<
telerik:QualitativeRange
Brush
=
"Green"
/>
</
telerik:RadBulletGraphBase.QualitativeRanges
>
</
telerik:RadHorizontalBulletGraph
>
</
Grid
>
</
sdk:Page
>
The values are all doubles, as here:
_BulletAggregators.Add(
new
BulletAggregator() { Actual = 121.00, Low = 115.00, High = 188.00, Mean = 151.80, Median = 153.00, Current = 121.00, Goal = 119 });
And the exception thrown:
System.InvalidOperationException
An unhandled exception was encountered while trying to render the current silverlight project on the design surface.
To
diagnose this failure, please try to run the project in a regular browser using the silverlight developer runtime.
at Microsoft.Windows.Design.Platform.SilverlightViewProducer.OnUnhandledException(
Object
sender, ViewUnhandledExceptionEventArgs e)
at Microsoft.Expression.Platform.Silverlight.SilverlightPlatformSpecificView.OnUnhandledException(
Object
sender, ViewUnhandledExceptionEventArgs args)
at Microsoft.Expression.Platform.Silverlight.Host.SilverlightImageHost.<>c__DisplayClass1.<Application_UnhandledException>b__0(
Object
o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(
Delegate
callback,
Object
args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(
Object
source,
Delegate
method,
Object
args, Int32 numArgs,
Delegate
catchHandler)
System.InvalidOperationException
[NoElements]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.51204.0&File=System.Core.dll&Key=NoElements
at System.Linq.Enumerable.Min(IEnumerable`1 source)
at Telerik.Windows.Controls.BulletGraph.RadBulletGraphBase.CalculateDataRange(
Double
& dataMin,
Double
& dataMax) in c:\Builds\WPF_Scrum\Release_SL_2010_Q3\Sources\Development\Controls\DataVisualization\BulletGraph\Base\RadBulletGraphBase.cs:line 676
at Telerik.Windows.Controls.BulletGraph.RadBulletGraphBase.ReCalculateRange() in c:\Builds\WPF_Scrum\Release_SL_2010_Q3\Sources\Development\Controls\DataVisualization\BulletGraph\Base\RadBulletGraphBase.cs:line 786
at Telerik.Windows.Controls.BulletGraph.RadBulletGraphBase.OnLayoutUpdated(
Object
sender, EventArgs e) in c:\Builds\WPF_Scrum\Release_SL_2010_Q3\Sources\Development\Controls\DataVisualization\BulletGraph\Base\RadBulletGraphBase.cs:line 752
at System.Windows.FrameworkElement.OnLayoutUpdated(
Object
sender, EventArgs e)
at MS.Internal.JoltHelper.
RaiseEvent
(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)
When I run the application, the BulletGraph simply doesn't appear. Is there a better way to add qualitative ranges with bound values?
-Jonathan