This question is locked. New answers and comments are not allowed.
Hi there,
I'm trying the new Universal UI and I ran in this exception when binding to an ObservableDictionary<string, int>
What's wrong with it?
I'm trying the new Universal UI and I ran in this exception when binding to an ObservableDictionary<string, int>
System.ArgumentException:
Dynamic getter is not supported for value type [KeyValuePair`2] at
Telerik.Universal.Core.DynamicHelper.CreatePropertyValueGetter(Type
type, String propertyName) at
Telerik.Universal.UI.Xaml.Controls.Chart.PropertyNameDataPointBinding.GetValue(Object
instance) at
Telerik.Universal.UI.Xaml.Controls.Chart.CategoricalSeriesDataSource.InitializeBinding(DataPointBindingEntry
binding) at
Telerik.Universal.UI.Xaml.Controls.Chart.ChartSeriesDataSource.GenerateDataPoint(ObjeHere's the code that I'm using:
01.
public
ObservableDictionary<
string
,
int
> MyDict {
get
;
set
; }
02.
...
03.
private
void
UpdateStats()
04.
{
05.
MyDict.Clear();
06.
foreach
(var item
in
Items)
07.
{
08.
var dayString = item.When.Date.ToLocalTime().ToString();
09.
var dayKey = dayString.Split(
' '
)[0];
10.
MyDict[dayKey] = (MyDict.ContainsKey(dayKey)) ? MyDict[dayKey] + 1 : 1;
11.
}
12.
}
01.
<
chart:RadCartesianChart
x:Name
=
"lineSeries"
02.
PaletteName
=
"DefaultLight"
03.
ClipToBounds
=
"False"
>
04.
<
chart:RadCartesianChart.VerticalAxis
>
05.
<
chart:LinearAxis
/>
06.
</
chart:RadCartesianChart.VerticalAxis
>
07.
<
chart:RadCartesianChart.HorizontalAxis
>
08.
<
chart:CategoricalAxis
AutoGroup
=
"True"
09.
PlotMode
=
"OnTicks"
/>
10.
</
chart:RadCartesianChart.HorizontalAxis
>
11.
<
chart:LineSeries
ItemsSource
=
"{Binding AsthmaStats}"
>
12.
<
chart:LineSeries.CategoryBinding
>
13.
<
chart:PropertyNameDataPointBinding
PropertyName
=
"Key"
/>
14.
</
chart:LineSeries.CategoryBinding
>
15.
<
chart:LineSeries.ValueBinding
>
16.
<
chart:PropertyNameDataPointBinding
PropertyName
=
"Value"
/>
17.
</
chart:LineSeries.ValueBinding
>
18.
</
chart:LineSeries
>
19.
</
chart:RadCartesianChart
>
What's wrong with it?