This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I need to either programmatically set the PieSeries.Brushes collection, or data bind to a collection via PieSeries.BrushesSource. Unfortunately, I can't get either approach to work. On the C# side: I have tried populating the brushes collection within the page constructor and within the Page_Loaded event. But the PieSeries object doesn't appear to exist at either stage in the page lifecycle (object is null). At what point in the page lifecycle will I have a guaranteed valid PieSeries object to work with? On the XAML/data binding side: I construct a List Help? Thanks. --lars |
|
|
Scratch that. I am now getting brushes via binding. My issues was using a generic IList instead of a specific IList Would still be good to get an answer on the programmatic side through around when the PieSeries object is valid... Thanks. --lars |
|
|
Hello lars The best way to do this is through binding as you are doing now. You can use an ObservableCollection to make dynamic updates to the brushes list if you need to. To do this in code behind, it is best to get the series through the PieChart.Series property. Use the index operator to get the series you need. This will work in the page constructor. I believe the reason why it does not work by giving the series a name and accessing it in code behind is because it is more of a model object - it is not immediately part of the visual tree and so the name can not be resolved ever. Jason Fauchelle |
|