Possible bug in time ruler stringformat

4 posts, 1 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 22 Mar 2011 Link to this post

    I was trying to change the formatting of the times in the time ruler to 12/24 hour format. For this I changed the TimerulerMajorTickStringFormat on the DayViewDefinition and the WeekViewDefinition to "\{0:t\}", which seems logical to me. But then the whole thing crashed. I then discovered that if I bind the value against the following property in my viewmodel, it works fine:
    string TimeStringFormat = "{0:t}";

    Is there anything else I have to do when putting the stringformat directly in the xaml, or is this a bug?

    /Henrik
  2. Answer
    Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 22 Mar 2011 Link to this post

    Hello Henrik,

    I guess you didn't escaped the curly brackets in the format string - "{}{0:t}", hence the crash. You could check the source code of our online exmaples for more information:
    http://demos.telerik.com/silverlight/#ScheduleView/CustomDateFormats

    Kind regards,
    Valeri Hristov
    the Telerik team
  3. DevCraft banner
  4. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 22 Mar 2011 Link to this post

    Ah.I did not know you had to do that. I thought escaping was done with the backslashes. Anyway, it works perfectly now, thank you.
  5. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 22 Mar 2011 Link to this post

    The special escaping is needed to instruct the XAML parser to treat the values, containing curly brackets as strings, not as markup extensions like Binding or StaticResource.

    Kind regards,
    Valeri Hristov
    the Telerik team
Back to Top