public class BubbleSeriesExt : BubbleSeries
{
protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue)
{
base.OnDataSourceChanged(oldValue, newValue);
if(ItemsSource != null && ListenPropertyChange)
foreach (var item in ItemsSource as IEnumerable)
{
INotifyPropertyChanged data = item as INotifyPropertyChanged;
if (data != null)
{
data.PropertyChanged -= OnItemPropertyChanged;
data.PropertyChanged += OnItemPropertyChanged;
}
}
}
void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
{
int position = -1;
IEnumerable itemsSource = (ItemsSource as IEnumerable);
foreach (object obj in itemsSource)
{
position++;
if (obj == sender)
break;
}
SetIndividualPoint(position, sender, true);
UpdateArea();
}
}
|
<chart:SfChart Grid.Row="1"
x:Name="chart" >
..
<local:BubbleSeriesExt XBindingPath="XValue" YBindingPath="YValue"
Size="ZValue" ListenPropertyChange="True"
ItemsSource="{Binding Data}"/>
</chart:SfChart> |