I have a scheduler which is hardcoded to be a weekly view. I would like to add a calculated value in the header for each day. In the attached screenshot, where the word "TEST" is, that's where my value should go. I stuck that text in there by creating a custom GroupHeaderContentTemplate, but I'm not sure how to make it a dynamic value.
My sheduleview is bound to an observable collection of a custom appointment class which inherits ScheduleView.Appointment. Where does the 'FormattedName' come from, maybe I can just append my value onto that? The value I'm trying to add is a total duration of the appointments for that day.
My sheduleview is bound to an observable collection of a custom appointment class which inherits ScheduleView.Appointment. Where does the 'FormattedName' come from, maybe I can just append my value onto that? The value I'm trying to add is a total duration of the appointments for that day.
7 Answers, 1 is accepted
0
Hi Kjell,
I have attached a sample project which demonstrates how the GroupHeders can be updated dynamically. You can use it as a base and extend it in order to achieve the exact requirement. In the Update() method inside AvailableTimeHelper class you should calculate the total duration of the appointments for that day and set it to Text property.
I hope this is helpful.
Regards,
Yana
Telerik
I have attached a sample project which demonstrates how the GroupHeders can be updated dynamically. You can use it as a base and extend it in order to achieve the exact requirement. In the Update() method inside AvailableTimeHelper class you should calculate the total duration of the appointments for that day and set it to Text property.
I hope this is helpful.
Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kjell
Top achievements
Rank 1
answered on 23 Jul 2013, 10:38 PM
Thanks Yana for the project, this is very helpful and I think I'm close to having it working. Your sample is a little bit above my head please bear with me. I have a question about this part:
<local:AvailableTimeHelper Appointments="{Binding Source={StaticResource ViewModel}, Path=Appointments}"
Date="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext.Name, Mode=TwoWay}"
Resource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext.ParentGroup, Mode=TwoWay}"
/>
You set Appointments to Viewmodel, is there a way to just have it grab whatever the source is for the scheduleview automatically? I am defining the scheduleview AppointmentsSource in the code behind. Or should I also set AvailableTimeHelper.Appointments in code when I set it for the scheduleview, if so how do I do that?
0
Hi Kjell,
If the Appointments is set with code, it will not be updated when a new appointment is added and the GroupHeaders will not receive the latest changes. So I would recommend trying to set the AppointmentsSource of the ScheduleView in a ViewModel and use the current approach.
Regards,
Yana
Telerik
If the Appointments is set with code, it will not be updated when a new appointment is added and the GroupHeaders will not receive the latest changes. So I would recommend trying to set the AppointmentsSource of the ScheduleView in a ViewModel and use the current approach.
Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kjell
Top achievements
Rank 1
answered on 24 Jul 2013, 05:22 PM
I can't change the binding of the scheduleview at this point. But I'd still like to take a stab at this customization. Can you show me how to bind to the AppointmentsSource anyway, and I'll see if I can work around the new appointment issue you pointed out.
I took a stab in the dark with this:
But Appointments was of course null in AvailableTimeHelper.
I took a stab in the dark with this:
Appointments="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AppointmentsSource}"
But Appointments was of course null in AvailableTimeHelper.
0
Hello Kjell,
You could try binding with ElementName set to the Name of the ScheduleVIew, check the snippet below:
Hope this helps.
Regards,
Yana
Telerik
You could try binding with ElementName set to the Name of the ScheduleVIew, check the snippet below:
Appointments="{Binding ElementName=radScheduleView, Path=AppointmentsSource}"
Hope this helps.
Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kjell
Top achievements
Rank 1
answered on 31 Jul 2013, 10:38 PM
Thanks Yana, as you warned me, appointmentssource didn't really work but it gave me another idea.
I'm guessing this is not a best practice, but I'll document here just in case it helps someone else.
I added 7 dependencyproperties to the radScheduleView, one for each day of the week. I keep them updated in the codebehind. I also added 7 properties to your helper class to match. I then use the update method in your helper class to set 'Text' to the appropriate value. This appears to be working for me, I can add/remove appointments and it's staying updated.
I'm guessing this is not a best practice, but I'll document here just in case it helps someone else.
I added 7 dependencyproperties to the radScheduleView, one for each day of the week. I keep them updated in the codebehind. I also added 7 properties to your helper class to match. I then use the update method in your helper class to set 'Text' to the appropriate value. This appears to be working for me, I can add/remove appointments and it's staying updated.
0
Hello Kjell,
I'm glad to hear that you've managed to find a suitable solution.
Regards,
Yana
Telerik
I'm glad to hear that you've managed to find a suitable solution.
Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>