Hi,
I am working with MVVM on a Telerik piechart
I have a Dictionnary<string, int> which I would like to represent with a piechart. The value could easily be represented on the piechart but the problem is the keys of the dictionnary are not considered as legend labels. How can I fix this problem?
<
telerik:RadChart
Margin
=
"15,15,15,15"
Grid.Row
=
"0"
Grid.Column
=
"1"
HorizontalAlignment
=
"Center"
Background
=
"Transparent"
BorderThickness
=
"0"
FontSize
=
"10"
ItemsSource
=
"{Binding Path=RightTopCollection}"
>
<
telerik:RadChart.DefaultSeriesDefinition
>
<
telerik:PieSeriesDefinition
>
<
telerik:PieSeriesDefinition.InteractivitySettings
>
<
telerik:InteractivitySettings
HoverScope
=
"Item"
SelectionScope
=
"Item"
SelectionMode
=
"Single"
/>
</
telerik:PieSeriesDefinition.InteractivitySettings
>
</
telerik:PieSeriesDefinition
>
</
telerik:RadChart.DefaultSeriesDefinition
>
</
telerik:RadChart
>
// In constructor
this._RightTopCollection = new Dictionary<
string
, int>() {{"firstLabel", 4}, {"secondLabel", 25}, {"thirdLabel", 17}, {"fourthLabel", 19}, {" fifthLabel", 7} };
// Class declaration
#region RightTopCollection
public const string RightTopCollectionPropertyName = "RightTopCollection";
private Dictionary<
string
, int> _RightTopCollection = null;
public Dictionary<
string
, int> RightTopCollection
{
get
{
return _RightTopCollection;
}
set
{
if (_RightTopCollection == value)
{
return;
}
var oldValue = _RightTopCollection;
_RightTopCollection = value;
// Update bindings, no broadcast
RaisePropertyChanged(RightTopCollectionPropertyName);
}
}
#endregion