Hi - I have a chart defined in XAML that is bound to an observable collection. The chart is defined as a line chart. I would like to make the chart type to be selectable, such as being able to change the chart from a line chart to a bar chart while keeping the data bindings. I have been trying to accomplish this by changing the series mappings and series definitions in the code behind, but seem to lose the data binding when the new chart is drawn. How is this accomplished ?
Thanks
Rich
<Controls:RadChart x:Name="evntChart" Height="150" Width="700" Visibility="{Binding ChartVisible, Mode=TwoWay}" ItemsSource="{Binding ChartItems}" > <Controls:RadChart.SeriesMappings> <Charting:SeriesMapping LegendLabel="Event Log Errors "> <Charting:SeriesMapping.SeriesDefinition> <Charting:LineSeriesDefinition /> </Charting:SeriesMapping.SeriesDefinition> <Charting:SeriesMapping.ItemMappings> <Charting:ItemMapping DataPointMember="XValue" FieldName="ChartDate" /> <Charting:ItemMapping DataPointMember="YValue" FieldName="EventCount" /> </Charting:SeriesMapping.ItemMappings> </Charting:SeriesMapping> </Controls:RadChart.SeriesMappings> <Controls:RadChart.DefaultView> <Charting:ChartDefaultView> <Charting:ChartDefaultView.ChartLegend> <Charting:ChartLegend x:Name="chartLegend" Header="Selected Event Log Errors" UseAutoGeneratedItems="True" /> </Charting:ChartDefaultView.ChartLegend> <Charting:ChartDefaultView.ChartArea > <Charting:ChartArea LegendName="chartLegend" EnableAnimations="False" TransitionControlStyle="{StaticResource TransitionControlStyle}"> <Charting:ChartArea.AxisX> <Charting:AxisX DefaultLabelFormat="dd-MMM" LabelRotationAngle="45"> </Charting:AxisX> </Charting:ChartArea.AxisX> </Charting:ChartArea> </Charting:ChartDefaultView.ChartArea> </Charting:ChartDefaultView> </Controls:RadChart.DefaultView> </Controls:RadChart>