Morten Bomholt
Top achievements
Rank 1
Morten Bomholt
asked on 28 May 2009, 10:36 AM
Hey at Telerik
I have hooked up the CellEditorInitialized event for the grid and tried to
change the Font of the opening Calander portion for a RadDatetimePickerColumn.
I can se at runtime that the instance of the DefaultBehaviour holds references to the RadCalender control in the RadDateTimePicker.
How can i change the Font of the Calender portion?
I also need to have weeknumbers enabled on the calender, but one solution fixes the other, i hope. :)
Regards
Morten.
I have hooked up the CellEditorInitialized event for the grid and tried to
change the Font of the opening Calander portion for a RadDatetimePickerColumn.
I can se at runtime that the instance of the DefaultBehaviour holds references to the RadCalender control in the RadDateTimePicker.
How can i change the Font of the Calender portion?
I also need to have weeknumbers enabled on the calender, but one solution fixes the other, i hope. :)
Regards
Morten.
7 Answers, 1 is accepted
0
Hello Morten Bomholt,
Thank you for writing us.
Here is a sample code which demonstrates how to modify RadDateTimePickerElement's Calendar Font settings and how to show the week numbers and modify the HeaderWidth of RadCalendar:
Kind regards,
Boyko Markov
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.
Thank you for writing us.
Here is a sample code which demonstrates how to modify RadDateTimePickerElement's Calendar Font settings and how to show the week numbers and modify the HeaderWidth of RadCalendar:
// get calendar behavior's instance used in RadDateTimePicker |
RadDateTimePickerCalendar calendarBehavior = (this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar); |
// change calendar's Font |
calendarBehavior.Calendar.Font = new Font(this.Font.FontFamily, 13); |
// show weekNumbers |
calendarBehavior.Calendar.ShowRowHeaders = true; |
// set the headerWidth property |
calendarBehavior.Calendar.HeaderWidth = 30; |
Kind regards,
Boyko Markov
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.
0
Morten Bomholt
Top achievements
Rank 1
answered on 02 Jun 2009, 07:22 AM
Hello Boyko Markov
I have tried to implement the code you have pasted, but with no luck.
I still end up with a non styled Calender popup control and datetimepickerdropdown element.
the entire radgrid needs to be set by the font class attribute and also the editors.
below is a link to a little sample project which illustrates my problem.
http://80.166.206.186/Screendump/RadDateTimePickerCalenderIssue.rar
Regards
Morten
0
Hello Morten Bomholt,
Thank you for the sample project. It helped me a lot. I have tested it and I have found a solution. I have modified a bit of your code about adding a new loop which iterates over the Calendar cells and set the Font property explicitly. This code also demonstrates how to get a single cell in RadCalendar. I believe this will help you in further debugging and testing. The actual cell type used in RadCalendar is CalendarCellElement.
private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (((RadGridView)sender).ActiveEditor.GetType() == typeof(RadDateTimeEditor))
{
RadDateTimePickerCalendar calendarBehavior = (((RadDateTimeEditor)((RadGridView)sender).ActiveEditor).GetCurrentBehavior() as RadDateTimePickerCalendar);
calendarBehavior.Calendar.Font = this.radGridFont;
calendarBehavior.Calendar.ShowRowHeaders = true;
foreach (RadItem item in ((calendarBehavior.Calendar.CalendarElement.CalendarVisualElement as MonthViewElement).TableElement.Children))
{
item.Font = this.radGridFont;
}
}
}
Please write me again if you have more questions.
All the best,
Boyko Markov
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.
Thank you for the sample project. It helped me a lot. I have tested it and I have found a solution. I have modified a bit of your code about adding a new loop which iterates over the Calendar cells and set the Font property explicitly. This code also demonstrates how to get a single cell in RadCalendar. I believe this will help you in further debugging and testing. The actual cell type used in RadCalendar is CalendarCellElement.
private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (((RadGridView)sender).ActiveEditor.GetType() == typeof(RadDateTimeEditor))
{
RadDateTimePickerCalendar calendarBehavior = (((RadDateTimeEditor)((RadGridView)sender).ActiveEditor).GetCurrentBehavior() as RadDateTimePickerCalendar);
calendarBehavior.Calendar.Font = this.radGridFont;
calendarBehavior.Calendar.ShowRowHeaders = true;
foreach (RadItem item in ((calendarBehavior.Calendar.CalendarElement.CalendarVisualElement as MonthViewElement).TableElement.Children))
{
item.Font = this.radGridFont;
}
}
}
Please write me again if you have more questions.
All the best,
Boyko Markov
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.
0
Morten Bomholt
Top achievements
Rank 1
answered on 02 Jun 2009, 02:11 PM
Howdy again Boyko
Now the cells are styled as the should and a simple setting of the calender dropdownminsize ensures that the days not overlapped.
However, the header is not styled and the weeknumbers bigger than 9 are not showing properly because the column width of the column containing the weeknumbers remain unchanged when the dropdown is resized. (tried with 01-01-1900, so week 52 is shown together with 1 and so forth.
Regards
Morten.
Now the cells are styled as the should and a simple setting of the calender dropdownminsize ensures that the days not overlapped.
However, the header is not styled and the weeknumbers bigger than 9 are not showing properly because the column width of the column containing the weeknumbers remain unchanged when the dropdown is resized. (tried with 01-01-1900, so week 52 is shown together with 1 and so forth.
Regards
Morten.
0
Hi Morten Bomholt,
You should use in this scenario the calendar HeaderHeight and HeaderWidth properties so that you can modify Days header height or Week header Width. I hope this helps.
Sincerely yours,
Boyko Markov
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.
You should use in this scenario the calendar HeaderHeight and HeaderWidth properties so that you can modify Days header height or Week header Width. I hope this helps.
Sincerely yours,
Boyko Markov
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.
0
Morten Bomholt
Top achievements
Rank 1
answered on 08 Jun 2009, 06:37 AM
Hey Boyko
Thx for the tip on the week numbers, but my problem is also the Title Font, isn't it supposed to just change with the Font setting of the Calender control? The text format and text align can be set but cannot find any further settings to manipulate the Title with.
Regards Morten
0
Accepted
Hello Morten Bomholt,
You can modify the Font of the navigation title:
RadCalendarElement calendarElement = calendarBehavior.Calendar.CalendarElement as RadCalendarElement;
calendarElement.CalendarNavigationElement.Font = this.radGridFont;
Please contact me again if you need more information.
Kind regards,
Boyko Markov
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.
You can modify the Font of the navigation title:
RadCalendarElement calendarElement = calendarBehavior.Calendar.CalendarElement as RadCalendarElement;
calendarElement.CalendarNavigationElement.Font = this.radGridFont;
Please contact me again if you need more information.
Kind regards,
Boyko Markov
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.