Category / Section
How to add locale with RTL in Xamarin.Forms Calender (SfCalendar)
2 mins read
You can change the localization of the calendar in Right-To-Left direction by using the Locale property and FlowDirection property in Xamarin.Forms SfCalendar.
XAML
Change the layout direction of the calendar in the right-to-left direction by setting the FlowDirection to RightToLeft.
<ContentPage.Behaviors> <local:CalendarPageBehavior/> </ContentPage.Behaviors> <calendar:SfCalendar x:Name="calendar" FlowDirection="RightToLeft"> </calendar:SfCalendar>
C#
Set the culture name of the arabic language as "AR" to the Locale property of Calendar.
public class CalendarPageBehavior : Behavior<ContentPage> { SfCalendar calendar; protected override void OnAttachedTo(ContentPage bindable) { base.OnAttachedTo(bindable); calendar = bindable.FindByName<SfCalendar>("calendar"); calendar.Locale = new System.Globalization.CultureInfo("AR"); } }