Simple standalone sample of setting the Appointment color based on the Resource type

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    1 posts
    Member since:
    May 2012

    Posted 30 Jan 2013 Link to this post

    Hi,

    I am fairly new to Silverlight and need to get a sample together for my customer before they buy the Silverlight controls. I am trying to do very much the same as the documentation talks about, but can not get a simple example together.

    I need to set the color of the appointment based on the resource type - in my case the resources will be people. I want to show only the timeline view, and have each persons' appointments in a different color.

    Going through the documentation for Appointment style, I can't seem to get the source for the AppointmentStyleSelector easily - using the code from the Themes folder results in a seemingly endless list of resources that I haven't included and then can't find. If I use Blend to create a copy of the Template, it creates a non-working copy (it doesn't create the Property attribute on the Setter - I assume this is a bug in the version of Blend I have).

    I tried to use the code from the online demo (Appointment style demo), but that also has a reference to a Style that I can't see where it comes from - the AppointmentItemBaseStyle resource.

    Does anyone have a simple, standalone project that they could share with me that allows me to do what I am trying to do? I would be most grateful.

    Regards,
    Thomas
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 04 Feb 2013 Link to this post

    Hi Thomas,

    The article for AppointmentStyleSelector is a little bit outdated - the approach works but as you've noticed, you should copy all the referenced resources in the xaml file in order to customize the appointments' style.

    However, in the latest versions of the controls (since Q1 2012 SP1), there is an easier way to make such changes with the help of Implicit Styles - detailed information on the approach can be found here. This approach is used in our online demos, actually. Using implicit styles you will be able to create custom Styles based on the default ones and change only certain properties. I have prepared and attached to this thread a sample project showing how you could change the color of the appointments based on a resource. Please download it and give it a try. Note that you should reference .NoXaml assemblies.

    Hope this helps.

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top