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

Title Case DayNames in Android

1 Answer 69 Views
Calendar & Scheduling
This is a migrated thread and some comments may be shown as answers.
Adam Hill
Top achievements
Rank 1
Adam Hill asked on 28 Jun 2018, 09:20 PM

 Is there an equivalent to:

presenter.Style.DayNameTextEffect = TKCalendarTextEffect.Uppercase;

in Android?

I am already using a renderer to style Android cells successfully, but I did not see any way to get the Text of the DayName so I could do a simple

.ToUpper()

 on it.

 

Thanks.


1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 03 Jul 2018, 03:00 PM
Hello Adam,

You could define a CustomizationRule for the Calendar inside the custom renderer on Android and inside its Apply method get the Text of the DayName cells and execute toUpper() on it. Please check the quick example below:

class CustomCalendarRenderer : CalendarRenderer
{
    protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
    {
        base.OnElementChanged(e);
 
        if (this.Control != null)
            this.Control.CustomizationRule = new CustomizationRule();
    }
}

and the CustomizationRule definition:

public class CustomizationRule : Java.Lang.Object, IProcedure
{      
    public void Apply(Java.Lang.Object p0)
    {
        if (!(p0 is CalendarDayCell))
        {
            return;
        }
 
        CalendarDayCell calendarCell = p0.JavaCast<CalendarDayCell>();
        if (calendarCell.CellType == CalendarCellType.DayName)
        {
            String cellText = calendarCell.Text;
            if (cellText != null)
            {
                calendarCell.Text = cellText.ToUpper();
            }
        }
    }
}

You could check Customizations topic for more details on CustomizationRule feature of RadCalendar for Android.

I hope this would be helpful.

Regards,
Yana
Progress Telerik
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
Tags
Calendar & Scheduling
Asked by
Adam Hill
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or