Calendar Template / Theme

3 posts, 0 answers
  1. Amon-ra Mackie
    Amon-ra Mackie avatar
    6 posts
    Member since:
    Jan 2009

    Posted 30 Jul 2009 Link to this post

    I want to modify the theme of the calendar control using Expression blend.  To do this, I have tried to modify the template of the control by right-clicking the control, selecting Edit Template, and then selecting Edit a Copy.  Then, I replaced the RadCalendar related styles from the Summer theme generic.xaml file in my application resources.  My goal was to start with these styles and modify the color values for the brushes.  Most styles apply to the calendar, but the CalendarButton styles will not apply.  What am I missing?

    I don't want to include the entire generic.xaml file in the app.  Can anyone provide a way to accomplish this without including the entire file?
  2. Amon-ra Mackie
    Amon-ra Mackie avatar
    6 posts
    Member since:
    Jan 2009

    Posted 31 Jul 2009 Link to this post

    Well, I managed to get this to work by adding a handler to the LayoutUpdated event for the RadCalendar Control.  This will work for Silverlight 3, but I don't think it works for silverlight 2 - Silverlight three allows setting the Style property more than once.  How can I get this to work with Silverlight 2 or is there a best practice that I'm missing?

     

    void calendar_LayoutUpdated(object sender, EventArgs e)  
            {  
                if (calendar.DisplayMode == DisplayMode.MonthView)  
                {  
                    SetCalendarButtonSytle(calendar);  
                }  
            }  
     
            private static void SetCalendarButtonSytle(UIElement cal)  
            {  
                IList<CalendarButton> buttons = cal.ChildrenOfType<CalendarButton>();  
                foreach (var button in buttons)  
                {  
                    if (button.ButtonType == CalendarButtonType.Date ||  
                        button.ButtonType == CalendarButtonType.WeekNumber ||  
                        button.ButtonType == CalendarButtonType.TodayDate)  
                    {  
                        button.Style = Application.Current.Resources["calendarButtonStyle"as Style;  
                    }  
                }  
            } 

  3. DevCraft banner
  4. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 04 Aug 2009 Link to this post

    Hello Amon-ra Mackie,

    Consider using the DayButtonStyleSelector or DayTemplateSelector property of the RadCalendar, as you want to define more than one style for same control. Check our online examples demonstrating the above technics.

    Regards,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top