This is a migrated thread and some comments may be shown as answers.

Possible bug in time ruler stringformat

3 Answers 72 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 22 Mar 2011, 11:08 AM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Valeri Hristov
Telerik team
answered on 22 Mar 2011, 11:16 AM
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
0
hwsoderlund
Top achievements
Rank 1
answered on 22 Mar 2011, 11:37 AM
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.
0
Valeri Hristov
Telerik team
answered on 22 Mar 2011, 11:40 AM
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
Tags
ScheduleView
Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
hwsoderlund
Top achievements
Rank 1
Share this question
or