How to change the backcolor for each date

14 posts, 0 answers
  1. ranjani
    ranjani avatar
    1 posts
    Member since:
    Feb 2009

    Posted 06 Feb 2009 Link to this post


    I need to set backcolor for each date ,how to set background color at run time for calendar control .
  2. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 06 Feb 2009 Link to this post

    I wanted to add to this, a feature request of sorts, is there any chance we are going to be seeing Special Days (like in the ASP.Net Ajax controls) in the Q1 or Q2 release? :)
  3. DevCraft banner
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 Feb 2009 Link to this post

    Hello guys,

    We already have this! Please check following demo:
    http://demos.telerik.com/silverlight/#Calendar/SpecialDays

    All the best,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Ulrich Fiege
    Ulrich  Fiege avatar
    62 posts
    Member since:
    Sep 2005

    Posted 21 Jul 2010 Link to this post

    I also interested in this sample but i get a error that this demo is not running in XBAP Mode?
    Greetings ...
  6. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 23 Jul 2010 Link to this post

    Hello Ulrich Fiege,

    Find the correct link for the xbap online demos.

    Regards,
    Kaloyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Valentijn
    Valentijn avatar
    21 posts
    Member since:
    Sep 2010

    Posted 16 Dec 2010 Link to this post

    Hi

    It seems this link does no longer work:

    http://demos.telerik.com/silverlight/#Calendar/SpecialDays

    I would like to know more about the special days feature in Silverlight Calendar control.

    Valentijn
  8. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 21 Dec 2010 Link to this post

    Hi Valentijn,

    You can find a brand new example following this link. It uses a custom style/template selectors applied to the calendar items.

    Greetings,
    Kaloyan
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  9. Geoffrey
    Geoffrey avatar
    2 posts
    Member since:
    Sep 2010

    Posted 21 Dec 2010 Link to this post

    Hi

    Thank you for the link.
    I have tried it, but i cannot see how i would assign events to the eventscollection from code behind. When i try to assign a name to the eventcollection resource, in code behind at runtime the eventscollection is not instantiated. If i try to create my own eventscollection in code behind and try to  assign in to the templateselector, the templateselector at runtime is also null.

    If i don't use code behind it works, otherwise there seems to be no way.

    How can i use the  templateselector from code behind?

     

     

     

     

  10. Geoffrey
    Geoffrey avatar
    2 posts
    Member since:
    Sep 2010

    Posted 21 Dec 2010 Link to this post

    Is there any way you can add days to the calendar that would show up in a different style immediately at runtime?

    If you add the days to the eventscollection as in the example and you give it to the daystyleselector, the style will only be updated in the beginning when the calendar is rendered, but it will not update the style when you add events at runtime (for example if someone clicks a date in the calendar).

    I need a way to let the user select and deselect dates in the calendar without using CTRL to select multiple dates. Also when a user clicks a date now, all the other days are deselected. Is there anyway to change this behavior? I thought the example using the eventscollection would help me, but the calendar is not update when adding or removing days to the eventsCollection.

    Could someone point me in the right direction please?

    Thank you
  11. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 27 Dec 2010 Link to this post

    Hi ranjani,

    All you have to do is update the DayTemplateSelector or StyleSelector with a new one. You can achieve that by setting it to null and then going back to the old one. You can put this code when a collection changing appears. Let us know if the approach is not clear enough.

    Best wishes,
    Kaloyan
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  12. Sodi We
    Sodi We avatar
    160 posts
    Member since:
    Apr 2010

    Posted 13 Jan 2011 Link to this post

    Hello,

    I'm having the same problem. I've done everything as described, but I'm not sure what you mean with the following:

    All you have to do is update the DayTemplateSelector or StyleSelector with a new one. You can achieve that by setting it to null and then going back to the old one.

    I've tried the following things:
    1. In the codebehind: set the DayTemplateSelector of the Calendar control to null, and then back to the same DataTemplateSelector.
    2. Remove the DataTemplateSelector from the resources and then add it again.
    3. Call Calendar.UpdateLayout()
    4. Create a new DataTemplateSelector in codebehind and set this as the DayTemplateSelector.

    None of the approaches makes the calendar draw itself again with the correct daytemplates. Is there something I'm missing?

    Thankx,
    Sodi


  13. Valentijn
    Valentijn avatar
    21 posts
    Member since:
    Sep 2010

    Posted 13 Jan 2011 Link to this post

    Hi

    For me it was not working too, until i downloaded the latest hotfix. Just look and see if you have the latest version.

    best regards

    Valentijn
  14. Sodi We
    Sodi We avatar
    160 posts
    Member since:
    Apr 2010

    Posted 13 Jan 2011 Link to this post

    Hi Valentijn,

    For me it seems to work when I set the Template in codebehind to null and than back to its old value. So something like this:

    public void UpdateEventsCollection()
            {
                ObservableCollection<CalendarItemDto> newEventsCollection = new EventsCollection();
                newEventsCollection.AddRange(ViewModel.SelectedCalendarItems);
                var templateSelector = calendar.DayTemplateSelector as EventDayTemplateSelector;
                templateSelector.EventsCollection = newEventsCollection as EventsCollection;
                //trigger the SelectTemplate() of the changed TemplateSelector
                var oldTemplate = calendar.Template;
                calendar.Template = null;
                calendar.Template = oldTemplate;
     
            }

    How do you trigger that the SelectTemplate of the DayTemplateSelector is fired again?

    Thanks,
    Sodi
  15. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 14 Jan 2011 Link to this post

    Hello ranjani,

    You can also download the 2010-Q3-2010 SP1 that will be launched later today and enjoy the new improvements regarding the other controls.

    Regards,
    Kaloyan
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top
DevCraft banner