Hello,
I have a pie chart bound to a observable collection of some data objects. Chart Series is bound to a property of this data object. When I add new object into collection chart gets updated, but when I change value of the property that is bound to the series - it is not reflected in the chart. Is it by design or just some oversight in the current version? Or there is another way to get the result I want?
Thank you!
Here is an example:
public class Venue : DependencyObject
{
public Venue() { } public static readonly DependencyProperty NameProperty = DependencyProperty.Register("Name", typeof(string), typeof(Venue), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender)); public string Name { get { return (string)GetValue(NameProperty); } set { SetValue(NameProperty, value); } } public static readonly DependencyProperty PercentProperty = DependencyProperty.Register("Percent", typeof(double), typeof(Venue), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender))); public double Percent { get { return (double)GetValue(PercentProperty); } set { SetValue(PercentProperty, value); } }}
<Window.Resources> <local:Venues x:Key="selectedVenues"/>
</Window.Resources>
<Grid>
<ChartFX:Chart x:Name="distChart" Style="{DynamicResource chartStyle}" Background="LightGray" Gallery="Pie" ItemsSource="{Binding Source={StaticResource selectedVenues}}"> <ChartFX:SeriesAttributes BindingPath="Percent" > </ChartFX:SeriesAttributes> </ChartFX:Chart> </Grid>