How to Dynamic SliceStyleSelector

3 posts, 0 answers
  1. Kadir Kilicoglu
    Kadir Kilicoglu avatar
    11 posts
    Member since:
    Apr 2010

    Posted 05 Dec 2013 Link to this post


    I've a problem with the SliceStyleSelector. Actually i couldn't find a decent example. I'm struggling with the piechart and binding custom object which includes Color property in object. What i want to do is take that color property and bind it to slice style (fill) but how? Try to bind Color property to Setters Value but it raised a exception that can't bind to read-only value. I've found something like But it shows basic implementation. Is there any detailed example or anyone show an example?

  2. Kiril Stanoev
    Kiril Stanoev avatar
    1508 posts

    Posted 09 Dec 2013 Link to this post

    Hi Kadir,
    Unfortunately such scenario is not supported. Sorry for the inconvenience caused.

    Kiril Stanoev
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Till
    Till avatar
    2 posts
    Member since:
    Oct 2012

    Posted 24 Oct 2014 in reply to Kiril Stanoev Link to this post


    I have the same requirements for my app, looked at the link you provided and found a solution:

    Create a custom StyleSelector for you chart. Inside the SelectStyle override method access the DataObject that you provide via a Binding to the ItemsSource of your PieSeries like this:
    var color = ((SimpleTimesheet.Portable.ViewModel.ChartItem) (((Telerik.Charting.DataPoint) (item)).DataItem)).Color;
    and just return a new Style with the color from your Databound Object:
    var style = new Style(typeof(Path));
        new Setter(
            new SolidColorBrush(color.ToMediaColor())
    return style;

    Hope this helps. Let me know if you need an example.
Back to Top