This is a migrated thread and some comments may be shown as answers.

Calendar Template / Theme

2 Answers 102 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Amon-ra Mackie
Top achievements
Rank 1
Amon-ra Mackie asked on 30 Jul 2009, 08:22 PM
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 Answers, 1 is accepted

Sort by
0
Amon-ra Mackie
Top achievements
Rank 1
answered on 31 Jul 2009, 05:03 PM
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;  
                }  
            }  
        } 

0
Kaloyan
Telerik team
answered on 04 Aug 2009, 07:49 AM
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.
Tags
Calendar
Asked by
Amon-ra Mackie
Top achievements
Rank 1
Answers by
Amon-ra Mackie
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or