Here is the xaml:
Here is the code behind:
The problem is when I click the Test button in the example the series does not refresh. This is a simplified example of what we are trying to do but would like the ItemsSource property of the series to behave like it should and update if the binding changes. Any help on this issue is appreciated.
<UserControl x:Class=
"Example.ScatterPlotPanel"
xmlns:local=
"clr-namespace:Exponent.Sensor.Pet.Analysis"
xmlns:telerik=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Name=
"_this"
>
<Grid>
<telerik:RadPolarChart x:Name=
"chart"
StartAngle=
"90"
>
<telerik:RadPolarChart.Grid>
<telerik:PolarChartGrid GridLineVisibility=
"Both"
StripesVisibility=
"Radial"
>
<telerik:PolarChartGrid.RadialStripeBrushes>
<SolidColorBrush Color=
"#FFD7D7D7"
Opacity=
"0.3"
/>
<SolidColorBrush Color=
"Transparent"
/>
</telerik:PolarChartGrid.RadialStripeBrushes>
</telerik:PolarChartGrid>
</telerik:RadPolarChart.Grid>
<telerik:RadPolarChart.RadialAxis>
<telerik:NumericRadialAxis ShowLabels=
"False"
/>
</telerik:RadPolarChart.RadialAxis>
<telerik:RadPolarChart.PolarAxis>
<telerik:PolarAxis Minimum=
"0"
/>
</telerik:RadPolarChart.PolarAxis>
<telerik:RadPolarChart.Series>
<telerik:PolarPointSeries x:Name=
"series"
ItemsSource=
"{Binding ElementName=_this, Path=DataPoints}"
AngleBinding=
"MissAngleDegrees"
ValueBinding=
"MissDistanceMeters"
>
<telerik:PolarPointSeries.PointTemplate>
<DataTemplate>
<Ellipse Height=
"4"
Width=
"4"
>
<Ellipse.Style>
<Style TargetType=
"Ellipse"
>
<Setter Property=
"Fill"
Value=
"Red"
/>
<Style.Triggers>
<DataTrigger Binding=
"{Binding Path=DataItem.IsHit}"
Value=
"True"
>
<Setter Property=
"Fill"
Value=
"Green"
/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
</DataTemplate>
</telerik:PolarPointSeries.PointTemplate>
</telerik:PolarPointSeries>
</telerik:RadPolarChart.Series>
</telerik:RadPolarChart>
<Button Content=
"Test"
Click=
"OnUpdateDataPoints"
/>
</Grid>
</local:AnalysisPanel>
Here is the code behind:
public
class
AlarmData
{
private
double
missDistance;
private
double
missAngle;
private
bool
isHit;
public
AlarmData()
{
}
public
AlarmData(
bool
isHit,
double
missDistance,
double
missAngle)
{
this
.isHit = isHit;
this
.missDistance = missDistance;
this
.missAngle = missAngle;
}
public
bool
IsHit
{
get
{
return
isHit; }
set
{ isHit = value; }
}
public
double
MissDistanceMeters
{
get
{
return
missDistance.Meters; }
}
public
double
MissAngleDegrees
{
get
{
return
missAngle.Degrees; }
}
}
public
partial
class
ScatterPlotPanel : UserControl, INotifyPropertyChanged
{
private
List<AlarmData> dataPoints =
new
List<AlarmData>();
public
event
PropertyChangedEventHandler PropertyChanged;
public
ScatterPlotPanel()
{
InitializeComponent();
}
protected
void
OnPropertyChanged(
string
propertyName)
{
try
{
if
(PropertyChanged !=
null
)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
catch
(Exception ex)
{
}
}
protected
override
void
OnUpdateDataPoints(
object
sender, RoutedEventArgs e)
{
dataPoints.Clear();
Random random =
new
Random();
for
(
int
i = 0; i < 100; i++)
{
dataPoints.Add(
new
AlarmData(random.Next(0, 2) != 0, Distance.FromCentimeters(random.Next(0, 400)), Angle.FromDegrees(random.Next(0, 359))));
}
OnPropertyChanged(
"DataPoints"
);
}
public
List<AlarmData> DataPoints
{
get
{
return
dataPoints; }
}
}
The problem is when I click the Test button in the example the series does not refresh. This is a simplified example of what we are trying to do but would like the ItemsSource property of the series to behave like it should and update if the binding changes. Any help on this issue is appreciated.