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

Change text color of weeknumbers

4 Answers 328 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Maurits
Top achievements
Rank 1
Maurits asked on 04 Jul 2016, 08:10 PM

How do I change the color of the week numbers (either in Block or in Inline mode)?

I tried assigning a color to the "CalendarAdapter.WeeknumberCell.TextColor" property but this doesn't seem to work. Below is the code I am using now (the day names and title do change color):

var calendarView = (RadCalendarView)FindViewById(Resource.Id.calendarView);
var textColor = ContextCompat.GetColor(this.BaseContext, Resource.Color.uurwerk_purple);
 
var calendarAdapter = calendarView.Adapter;
calendarAdapter.DayNameTextColor = textColor;
calendarAdapter.TitleTextColor = textColor;
calendarAdapter.WeekNumberCell.TextColor = textColor;

4 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 05 Jul 2016, 02:29 PM
Hi Maurits,

Thanks for writing.

Here's a code snippet that demonstrates how cells are styled:

CalendarDayCellFilter weekendCellFilter = new CalendarDayCellFilter();
weekendCellFilter.IsWeekend = new Java.Lang.Boolean(true);
CalendarDayCellStyle weekendCellStyle = new CalendarDayCellStyle();
weekendCellStyle.Filter = weekendCellFilter;
weekendCellStyle.TextColor = new Java.Lang.Integer(Color.Red.ToArgb());
calendarView.AddDayCellStyle(weekendCellStyle);


You can read more about cell styling here: 

http://docs.telerik.com/devtools/android/controls/calendar/calendar-customizations#defining-set-of-cell-styles

I hope this helps.

Regards,
Deyan
Telerik by Progress
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 Feedback Portal and vote to affect the priority of the items
0
Maurits
Top achievements
Rank 1
answered on 05 Jul 2016, 03:10 PM

Hi Deyan,

This doesn't really help me, since the filter does not allow you to check for week numbers, only for weekends. I need a little bit more information please.

0
Accepted
Deyan
Telerik team
answered on 08 Jul 2016, 07:36 AM
Hello Maurits,

Thanks for writing back.

You will need to set the CellType property to instruct the filter which cells to style as the documentation states:

"

Here are the methods for the CalendarDayCellFilter which allow you to filter the cells that use a certain style:

  • setCellType - to apply style to dates, dayNames, weekNumbers or titles; default is Date
  • setIsSelected - to apply style only to cells which are selected
  • setIsFromCurrentMonth - to apply style only to cells from the current month and not to the visible cells from the previous and the next months
  • setIsToday - to apply the style only to the today cell
  • setIsWeekend - to apply the style only to cells used to display Saturdays and Sundays
  • setCustom - if none of the above works for you, you can add a custom function which based on a passed cell, returns true or false, depending on whether the cell should be customized.
"

Please take a look at the article I pasted in my previous post for more information.

Regards,
Deyan
Telerik by Progress
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 Feedback Portal and vote to affect the priority of the items
0
Maurits
Top achievements
Rank 1
answered on 09 Jul 2016, 08:37 AM
Thank you Deyan for pointing out the setCellType method (or CellType property in C#). This did the trick for me.
Tags
Calendar
Asked by
Maurits
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Maurits
Top achievements
Rank 1
Share this question
or