I have this right now, but "DetailText" seems to be all appointments concatenated together.
<telerikInput:RadCalendar.ItemTemplate>
<DataTemplate>
<Grid Margin="5">
<StackPanel Background="{Binding CANCELLATION_ID, Converter={StaticResource CancelledColorConverter} }">
<TextBlock Text="{Binding DetailText}" Foreground="Red" FontSize="7" MaxHeight="25" VerticalAlignment="Top" Margin="0,-2,0,0"/>
</StackPanel>
<TextBlock Text="{Binding Text}" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
</Grid>
</DataTemplate>
</telerikInput:RadCalendar.ItemTemplate>
6 Answers, 1 is accepted
Sorry for the late reply - there is a new property available in the CalendarButtonContentInfo class called Appointments. You can use it in your data template with a converter to style each appointment.
Best wishes, Valentin.Stoychev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
Do I need updated binaries for this?
I'm currently on 2011.2.712.1037
Thank you for writing.
In order to achieve different colors for different appointments you must define a custom item template that contains as many TextBlock objects as there are appointments for a certain day. Since the number of appointments will vary from day to day you have have to determine what is the maximum number of appointments that you want to display and create the template with this many TextBlock objects.
After the template is ready, you have to bind the text blocks' Text and Foreground properties to the DetailText property of the view model that the your custom ItemTemplate binds to. The trick here is that the view model's DetailText property contains all appointments concatenated in a single string delimited by new lines. You somehow have to split that string into individual appointments and bind each text block to the correct appointment. Fortunately this can easily be done with a custom binding converter.
Another subtle thing is that the Foreground property of the text blocks is bound a property of type string. Again, a custom binding converter must be used and with this converter you will be able to define a custom color for each appointment.
Please have a look at the sample application that I prepared (see attachment). It contains a basic implementation of the description above.
Please write again if you have other questions.
Victor
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
In my scenario, we have different appointment types which have different colors. I need to be able to show a little text and color code it based on the appropriate color (which is another property of the "SampleAppointment" class). How would you accomplish this?
Thanks in advance,
Brian
You are right that it will be good to introduce a custom property for this scenario. How it is sounds to have a Tag called property of type object as part of the IAppointment interface? Will this fit your scenario?
Kind regards, Valentin.Stoychev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>