I am attempting to copy arbitrary UI elements by serializing and deserializing them to XAML. However, the XamDataChart causes issues because the Series property is skipped.
For example, with the following XAML,
<ig:XamDoughnutChart x:Name="doughnutChart" Width="400" Height="400" InnerExtent="50" CenterData="Deps"> <ig:XamDoughnutChart.Series> <ig:RingSeries x:Name="ringSeries" ItemsSource="{Binding TestData}" LabelMemberPath="Label" ValueMemberPath="Spending" LabelsPosition="BestFit" LabelExtent="20" OthersCategoryType="Number" OthersCategoryThreshold="35" RadiusFactor="0.8" /> </ig:XamDoughnutChart.Series> </ig:XamDoughnutChart>
The output is only the top-level XamDoughnutChart.
XamDoughnutChart
<ig:XamDoughnutChart InnerExtent="50" CenterData="Deps" PixelScalingRatio="NaN" Name="doughnutChart" Width="400" Height="400"> <ig:XamDoughnutChart.SelectedSlices> <ig:SliceCollection /> </ig:XamDoughnutChart.SelectedSlices> <ig:XamDoughnutChart.ExplodedSlices> <ig:SliceCollection /> </ig:XamDoughnutChart.ExplodedSlices> </ig:XamDoughnutChart>
Is there a way to have the Series property serialized correctly?
Hello William,
I have been investigating into the behavior you are seeing with the XamDataChart / XamDoughnutChart and the XamlWriter, and while I am not entirely sure why the XamlWriter is not serializing the Series collection in this case, I do not believe this is something that is going to be configurable in this case and I would like to offer an alternative.
The alternative that I would recommend in this case, as it seems like you are trying to persist the state of our controls is the Infragistics Control Persistence Framework, as we built this for that specific reason. You can read about this here: https://es.infragistics.com/help/wpf/control-persistence-framework. I believe this should help you to retain the state of your charts.
Please let me know if you have any other questions or concerns on this matter.