Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Calendar > Redraw/refresh RadCalendar?

Not answered Redraw/refresh RadCalendar?

Feed from this thread
  • Ben Lischner avatar

    Posted on Jan 11, 2010 (permalink)

    I'm wondering if there's an easy way to get the RadCalendar to re-render itself. I'm using a custom DayTemplateSelector to modify the appearance of dates, but the data that drives the appearance of the dates is not static. I need the ability to have the Calendar redraw so that it can re-calcuate its appearance when I update the underlying data that drives the formatting.

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Jan 14, 2010 (permalink)

    Hi Ben Lischner,

    We have a lot of requests for the scenario you are asking about. Unfortunately there is no way to accomplish it. We are working on resolving this issue and we will provide a fix in one of the nearest releases of our controls.

    Kind regards,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Albert Holt avatar

    Posted on Jan 26, 2010 (permalink)

    I am having the same issue.  Tried things like changing the current month and changing it back, but that doesn't work either - only if the user does this through the gui.  Can't understand why there isn't a simple rebind or refresh function?

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Jan 29, 2010 (permalink)

    Hello Albert Holt,

    We are aware of the limitation related to this scenario. We are planning to remove the limitation in the Q2 2010 official release. Please accept our apologies if we have caused you any troubles.


    Regards,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Adrian avatar

    Posted on Aug 31, 2010 (permalink)

    Any news?

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Sep 2, 2010 (permalink)

    Hello Adrian,

    Please accept our deep apologies. We didn't manage to fix the issue as we were developing some more major tasks during the Q2 time frame. Be sure that the task is in our priority list and will be completed very soon in the near future.

    All the best,
    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

    Reply

  • AlinRaul avatar

    Posted on Oct 4, 2010 (permalink)

    Hello there,

    Do you have an ETA on this? Thanks.

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Oct 7, 2010 (permalink)

    Hi AlinRaul,

    We can't  take on an exact estimation of the fix. We will try for the following Q3 release. Please accept our apologies.

    Best wishes,
    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

    Reply

  • Adrian avatar

    Posted on Oct 25, 2010 (permalink)

    Any news guys?

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Oct 27, 2010 (permalink)

    Hi Adrian,

    The task is logged in our TFS with a proper priority.

    Sincerely yours,
    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

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Oct 27, 2010 (permalink)

    Hi Adrian,


    Sincerely yours,
    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

    Reply

  • Michael avatar

    Posted on Nov 3, 2010 (permalink)

    I have exactly the same problem.
    Please let me know when a fix is in place.

    Thank you.

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Nov 9, 2010 (permalink)

    Hello Michael,

    You will be notified when a fix is provided.

    All the best,
    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

    Reply

  • Adam avatar

    Posted on Dec 10, 2010 (permalink)

    Was this fixed in the Q3 release? If not, has anybody implemented a work around? In our case it is the style selector that needs refreshing.

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Dec 11, 2010 (permalink)

    Hi Adam,

    We are currently working on the problem resolving.

    Best wishes,
    Kaloyan
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight

    Reply

  • Hristo Hristo admin's avatar

    Posted on Dec 14, 2010 (permalink)

    Hello Everyone,

    Just want to let you know that this issue is now Fixed and will be available in the next LIB (latest internal build).

    All the best,
    Hristo
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight

    Reply

  • Forest avatar

    Posted on Dec 15, 2010 (permalink)

    Hello

    Do the RadControls_for_Silverlight_4_2010_3_1213_TRIAL_hotfix.zip fix this problem ?

    Thank you very much.

    Mathieu

    Reply

  • Hristo Hristo admin's avatar

    Posted on Dec 15, 2010 (permalink)

    Hi Forest,

    Yes RadControls_for_Silverlight_4_2010_3_1213_TRIAL_hotfix should contain this fix.

    Greetings,
    Hristo
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight

    Reply

  • Jeff avatar

    Posted on Dec 15, 2010 (permalink)

    If this is fixed, then what is the solution to redraw the Day Buttons?

    Are you positive that RadControls_for_Silverlight_4_2010_3_1213_TRIAL_hotfix contains this fix?  The release notes detail no changes to the RadCalendar control at all.

    Reply

  • Hristo Hristo admin's avatar

    Posted on Dec 15, 2010 (permalink)

    Hi Jeff,

    There is one note that I should mention - there are few properties DayTemplate, DayTemplateSelector, DayButtonStyle and DayButtonStyleSelector. If you set DayTemplate then changes to DayTemplateSelector will not affect the containers. The same goes for DayButtonStyle. As a rule Selectors are applied only if not selectors properties (DayTemplate and DayButtonStyle in this case) are null.

    In our themes we have set both DayTemplate and DayButtonStyle properties so changing the selectors will not update the UI. The easiest solution is to set both properties to {x:Null} in XAML and then selector properties will be used and changing them will update the UI.

    Also if you want to apply the same template/style the you could just change DayTemplate or DayButtonStyle properties (without using Selector properties at all).

    Here is a link to our online help:
    http://www.telerik.com/help/silverlight/radcalendar-editing-button.html

    Let us know if you need more information.

    Greetings,
    Hristo
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight

    Reply

  • Jeff avatar

    Posted on Dec 15, 2010 (permalink)

    Ok, I under that I must not use both Selectors and selector properties.

    I am dynamically updating my custom DayTemplateSelector's Collection from the RadCalendar control itself with days that contain an event.

    I've followed the First Look example in the Demo solution.

    Here is my XAML code.

    <CollectionViewSource x:Key="AvailabilityView" x:Name="AvailabilityList" Filter="AvailabilityList_Filter" Source="{Binding collectionAvailabilityRecords}" />
         
        <Tyler:AvailabilityCollection x:Key="AvailabilityCollection">
        </Tyler:AvailabilityCollection>
         
        <Tyler:AvailabilityDayTemplateSelector x:Key="AvailablityDayTemplateSelector" x:Name="AvailDayTempSel" AvailabilityCollection="{StaticResource AvailabilityCollection}">

    <CollectionViewSource x:Key="AvailabilityView" x:Name="AvailabilityList" Filter="AvailabilityList_Filter" Source="{Binding collectionAvailabilityRecords}" />
        
        <Tyler:AvailabilityCollection x:Key="AvailabilityCollection">
        </Tyler:AvailabilityCollection>
        
        <Tyler:AvailabilityDayTemplateSelector x:Key="AvailablityDayTemplateSelector" x:Name="AvailDayTempSel" AvailabilityCollection="{StaticResource AvailabilityCollection}">

    Since these DayTemplateSelectors can only be bound to StaticResources, I've created an empty collection to assign to the DayTemplateSelector.

    Then in my calling UserControl code behind, I'm accessing the DayTemplate collection directly on the RadCalendar control and adding dates to that collection from my WCF service results.


    private void radCalendar1_refreshEventDays()
    {     
      ((OfficerScheduling.AvailabilityDayTemplateSelector)(radCalendar1.DayTemplateSelector)).AvailabilityCollection.Clear();
      foreach (Availability a in ((CalendarView) this.DataContext).collectionAvailabilityRecords)
      {
        ((OfficerScheduling.AvailabilityDayTemplateSelector)(radCalendar1.DayTemplateSelector)).AvailabilityCollection.Add(a);
      }
    }

    Whenever a user makes a change to affect the records being used in the DayTemplate Selector class, the WCF service is called again. In its AsyncCallback, it populates the DataConext.collectionAvailabilityRecords and then calls the radCalendar1_refreshEventDays() function above.

    Perhaps I'm not doing things correctly, but it works when the calendar is initially populated and displayed. So, how does this new update to the RadControl help in updating the display when the backing collection of the DayTemplateSelector changes?

    Reply

  • Hristo Hristo admin's avatar

    Posted on Dec 16, 2010 (permalink)

    Hi Jeff,

    I'm not sure that I understand your case. Could you please open a support ticket and attach a project demonstrating the problem? This way it will be much easier for me to help you.

    Kind regards,
    Hristo
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight

    Reply

  • Jeff avatar

    Posted on Dec 16, 2010 (permalink)

    Ok, I will do so, but I am pretty much doing exactly what everyone else in this thread is doing.

    I am using custom DayTemplateSelector class that is being controlled by a collection of dates.

    Your demo project uses a static collection, while everyone else here is using a dynamically populated collection.

    When new dates are added or removed to this collection, I and everyone else in this thread would like to see the DayTemplates that are being controlled by the DayTemplateSelector class updated when we change the collection of dates for that class.

    For example, on the initial draw of RadCalendar, my collection on the DayTemplateSelector are dates A, B, C.  The dates A, B, C are drawn with the special template highlighted in green. The user performs an action on the page that includes the RadCalendar that causes date D to be added to the collection of dates.

    Therefore, they would expect to see dates A, B, C, and now D highlighted in green.  But, the calendar doesn't draw this "D" date as green unless the user clicks the forward button away from the date range, and navigates back.  Doing this causes the RadCalendar to redraw the dates and now we see the A, B, C, and D dates as green.  Everyone here is asking for a way to either have the calendar redraw automatically on modification of the DayTemplateSelector's collection or force a redraw of the days without user interaction.

    If there was a "solution" to this problem, how do you force the redraw, or how do you setup the collection for the RadCalendar to notice the change in items?

    Reply

  • Hristo Hristo admin's avatar

    Posted on Dec 17, 2010 (permalink)

    Hi Jeff,

    I think I understand your case. You have custom DayTemplateSelector and at some point you are adding new DataTemplate to a collection in this custom DayTemplateSelector, right?

    RadCalendar is not listening for a collection or property change in DataTemplateSelector class (or its inheritors). That is why updating this collection does not redraw RadCalendar. We did not design RadCalendar to support this scenario.

    What we fixed was that updating DayTemplate, DayTemplateSelector, DayButtonStyle and DayButtonStyleSelector after calendar is loaded will redraw the calendar. In your case if you update your collection and then set DayTemplateSelector to null and then to the same selector will redraw the calendar.

    I hope this helps.

    Regards,
    Hristo
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight

    Reply

  • Jeff avatar

    Posted on Dec 17, 2010 (permalink)

    Excellent!  This bit of detail is just what I needed.  The calendar is redrawing with all dates. 

    Thanks for finally providing this functionality! 

    Reply

  • Forest avatar

    Posted on Dec 21, 2010 (permalink)

    Hi

    Can you provide us a sample project please ?

    Thank you

    Mathieu

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Dec 27, 2010 (permalink)

    Hello Ben Lischner,

    Find the attached application with the recommended approach.

    All the best,
    Kaloyan
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
    Attached files

    Reply

  • Forest avatar

    Posted on Dec 29, 2010 (permalink)

    Hello

    Thank you very much. It works.

    Mathieu

    Reply

  • Nick avatar

    Posted on Feb 11, 2011 (permalink)

    I have tried the attached sample project and when clicking the Add Date button the calendar does not redraw.  The custom day button style selector code is never hit.  I have the same issue as everyone else in that I need to update the dates being displayed based on a dynamic collection.  There doesn't seem to be a way to do this in the Silverlight version of this control.  Can you please test this sample app against the latest build?

    Thanks

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Feb 16, 2011 (permalink)

    Hi Nick,

    I can confirm that the feature is working with the latest build.

    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>>

    Reply

  • stefanbuchman avatar

    Posted on Feb 19, 2011 (permalink)

    Hi,

    This seems to work dynamically for adding dates to a calendar, however, it doesn't seem to work to remove dates from the calendar.  If I clear the collection I need to navigate away from the month and back again in order for the calendar to redraw?  Is there another way to do this?

    Thanks,

    Stefan

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Feb 23, 2011 (permalink)

    Hello Nick,

    You have to refresh (remove the temple or set a new one) it again in case of dates removing.

    Greetings,
    Kaloyan
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!

    Reply

  • Adam avatar

    Posted on Mar 22, 2011 (permalink)

    This appears to have broken in 2011 Q1 release. Resetting the DayButtonStyleSelector does not redraw the control.

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Mar 28, 2011 (permalink)

    Hi Nick,

    I have tried to reproduce the problem using the latest Q1.2011 build without any problem. Attached is the test project.

    All the best,
    Kaloyan
    the Telerik team
    Attached files

    Reply

  • Posted on Apr 7, 2011 (permalink)

    Hi,

    I noticed that after you remove an event and reset the selector using this code:

    var styleSelector = calendar.DayButtonStyleSelector;
    calendar.DayButtonStyleSelector = null;
    calendar.DayButtonStyleSelector = styleSelector;

    the SelectStyle method is called only for those days which had unmodified style (no events).

    As a workaround after removing event i used this:
    System.Collections.Generic.IList<Telerik.Windows.Controls.Calendar.CalendarButton> buttons =
         calendar.ChildrenOfType<Telerik.Windows.Controls.Calendar.CalendarButton>();
    foreach (var button in buttons)
    {
         if (button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.Date ||
              button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.WeekNumber ||
              button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.TodayDate)
         {
              button.Style = null;
         }
    }

    and after that reset the StyleSelector and styles got changed as expected.

    Is there another solution?

    Reply

  • Kasper Schou avatar

    Posted on Apr 8, 2011 (permalink)

    Nvm.. :)

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Apr 12, 2011 (permalink)

    Hi Kasper Schou,

    We will check the internal logic of the control. You can use the suggested code for now.

    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

    Reply

  • vassili avatar

    Posted on Nov 30, 2011 (permalink)

    hi,
    my point is to apply different styles (mainly background color) to daybutton depending on some management rules.

    Im using the suggested code to reset style and it's working good.

    var styleSelector = calendar.DayButtonStyleSelector;
    calendar.DayButtonStyleSelector = null;
    calendar.DayButtonStyleSelector = styleSelector;


    But it's rather slow, as it reset the global style selector. sometime, i dont need an full refresh.
    Is there a way to reset the style for a selection of days rather than all days?

    thanks u in advance

    Reply

  • vassili avatar

    Posted on Nov 30, 2011 (permalink)

    hi,
    my point is to apply different styles (mainly background color) to daybutton depending on some management rules.

    Im using the suggested code to reset style and it's working good.

    var styleSelector = calendar.DayButtonStyleSelector;
    calendar.DayButtonStyleSelector = null;
    calendar.DayButtonStyleSelector = styleSelector;


    But it's rather slow, as it reset the global style selector. sometime, i dont need an full refresh.
    Is there a way to reset the style for a selection of days rather than all days?

    thanks u in advance


    (sorry about the double post, i had errors on first submit but didnt check before resubmit my post)

    Reply

  • vassili avatar

    Posted on Nov 30, 2011 (permalink)

    ok i got it.

    using this part of code
    if (button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.Date ||
         button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.WeekNumber ||
         button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.TodayDate)
    {
         button.Style = null;
    }

    you should just change the style on ur button.
    Say i have 2 styles, it becomes like this

    if (button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.Date ||
         button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.WeekNumber ||
         button.ButtonType == Telerik.Windows.Controls.Calendar.CalendarButtonType.TodayDate)
    {
    if
    (button.Style == ((MyDayStyleSelector)calendar.DayButtonStyleSelector).FirstStyle)
        button.Style = ((MyDayStyleSelector)calendar.DayButtonStyleSelector).SecondStyle;
    else
        button.Style = ((MyDayStyleSelector)calendar.DayButtonStyleSelector).FirstStyle;
    }


    and there is no need to use that part anymore
    var styleSelector = calendar.DayButtonStyleSelector;
    calendar.DayButtonStyleSelector = null;
    calendar.DayButtonStyleSelector = styleSelector;

    Reply

  • Larissa avatar

    Posted on Jan 16, 2012 (permalink)

    I need to force redraw the RadCalendar too, but in telerik ASP.NET AJAX. Has it been fixed in ASP.NET AJAX version too?

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Calendar > Redraw/refresh RadCalendar?
Related resources for "Redraw/refresh RadCalendar?"

Silverlight Calendar Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]