Hello,
I'm using PieChart with VM-binding and have ArgumentNullException exception in ChartSelectionBehavior.Branch.cs:
My XAML:
ViewModel:
What am I doing wrong?
I'm using PieChart with VM-binding and have ArgumentNullException exception in ChartSelectionBehavior.Branch.cs:
internal
void
UpdateSelectedPointsAndRaiseSelectionChanged()
{
var oldSelectedPoints =
this
.chart.SelectedPoints;
// SelectedPoints is always null
var newSelectedPoints =
this
.GetSelectedPoints();
////var oldSelectedSeries = this.chart.SelectedSeries;
////var newSelectedSeries = this.GetSelectedSeries();
var addedPoints = newSelectedPoints.Except(oldSelectedPoints).ToList();
//exception here
var removedPoints = oldSelectedPoints.Except(newSelectedPoints).ToList();
My XAML:
<
telerik:RadPieChart
SelectedPoints
=
"{Binding SelectedPoints}"
>
<
telerik:RadPieChart.Resources
>
<
Style
x:Key
=
"PieSliceStyle"
TargetType
=
"Path"
>
<
Setter
Property
=
"Fill"
Value
=
"{Binding DataItem.Brush}"
/>
</
Style
>
</
telerik:RadPieChart.Resources
>
<
telerik:RadPieChart.SmartLabelsStrategy
>
<
telerik:PieChartSmartLabelsStrategy
DisplayMode
=
"SpiderAlignedOutwards"
/>
</
telerik:RadPieChart.SmartLabelsStrategy
>
<
telerik:RadPieChart.Behaviors
>
<
telerik:ChartSelectionBehavior
DataPointSelectionMode
=
"Multiple"
x:Name
=
"PieSelectionBehavior"
/>
</
telerik:RadPieChart.Behaviors
>
<
telerik:RadPieChart.Series
>
<
telerik:DoughnutSeries
ItemsSource
=
"{Binding PieChartErrors}"
ValueBinding
=
"Count"
DefaultSliceStyle
=
"{StaticResource PieSliceStyle}"
>
<
telerik:DoughnutSeries.LegendSettings
>
<
telerik:DataPointLegendSettings
TitleBinding
=
"Description"
/>
</
telerik:DoughnutSeries.LegendSettings
>
<
telerik:DoughnutSeries.LabelConnectorsSettings
>
<
telerik:ChartSeriesLabelConnectorsSettings
/>
</
telerik:DoughnutSeries.LabelConnectorsSettings
>
</
telerik:DoughnutSeries
>
</
telerik:RadPieChart.Series
>
</
telerik:RadPieChart
>
ViewModel:
public
class
ErrorsAndWarningsViewModel : Page
{
private
IObservableCollection<PieChartError> _pieChartErrors;
private
ReadOnlyDataPointCollection _selectedPoints;
public
ErrorsAndWarningsViewModel
{
PieChartErrors =
new
BindableCollection<PieChartError>();
SelectedPoints =
new
ReadOnlyDataPointCollection();
}
public
IObservableCollection<PieChartError> PieChartErrors
{
get
{
return
_pieChartErrors; }
set
{
if
(Equals(value, _pieChartErrors))
{
return
;
}
_pieChartErrors = value;
NotifyOfPropertyChange();
}
}
public
ReadOnlyDataPointCollection SelectedPoints
{
get
{
return
_selectedPoints; }
set
{
_selectedPoints = value;
NotifyOfPropertyChange();
}
}
public
class
PieChartError
{
public
string
Description {
get
;
set
; }
public
int
Count {
get
;
set
; }
public
Brush Brush {
get
;
set
; }
}
}
What am I doing wrong?