Dynamic LabelFormat?

3 posts, 1 answers
  1. Jesper
    Jesper avatar
    18 posts
    Member since:
    Jun 2012

    Posted 05 Jul 2012 Link to this post

    Hello,

    I'm currently getting myself introduced to ChartView and in my project I would like for the horizontal axis (DateTimeContinuousAxis) to dynamically select a LabelFormat depending on the time being presented. For full hours I'd like it to be "mm/ddd HH", otherwise just "HH:mm".

    I'd prefer to do it in MVVM if possible but I'm not too religious about it. I have tried using a converter but I don't know how to obtain the actual value being affected by the format.

    Can this be achieved?
  2. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 10 Jul 2012 Link to this post

    Hello Jesper,

    Your were on the right track with the converter.

    You should re-template the default LabelTemplate of the DateTimeContinuousAxis and in the DataTemplate and you should set the TextBlock to use your custom converter.

    Have a look at the attached project.

    Greetings,

    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jesper
    Jesper avatar
    18 posts
    Member since:
    Jun 2012

    Posted 12 Jul 2012 Link to this post

    Thanks Petar, that did it!
Back to Top