We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Language change & OnMonthCellLoaded

Thread ID:

Created:

Updated:

Platform:

Replies:

146689 Aug 14,2019 08:39 AM UTC Aug 26,2019 09:33 AM UTC Xamarin.Forms 7
loading
Tags: SfCalendar
jens de rijcke
Asked On August 14, 2019 10:03 AM UTC

Hello

I'm making an application with different languages and I'm making use of the SfCalendar. On the calendar there is a OnMonthCellLoaded.
calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;

This works fine whenever I just start the application. Every time I choose another language, I set the culture and set the current mainpage: 
App.Current.MainPage = new NavigationPage(new MainPage());

The language is changed. On the init of the page with the calendar I set the calendar language as following:
calendar.Locale = new CultureInfo(language);

The language is succesfully changed.

The cells load as wished when just starting the application or whenever I toggle a button and refresh the calendar. But whenever the language is changed (it doesn't matter if it's done on the calendar as well, so the problem is probably something with: App.Current.MainPage = new NavigationPage(new MainPage()); ), the OnMonthCellLoaded doesn't seem to apply on the displaying month, when I manually go 2 months further or back and then go back everything is displaying just fine. The calendar is on a tabview that is on the MainPage.

It's the same problem when I use:

await Navigation.PushModalAsync(new MainPage());

am I doing this wrong or is this a bug?

Regards,

Jens


Dinesh Babu Yadav [Syncfusion]
Replied On August 15, 2019 11:34 AM UTC

Hi Jens, 
 
We have analyzed your query. We suspect that your query is “OnMonthCellLoaded event is not triggered when calendar Lacale value is changed at runtime”. Could you please confirm your query? 
Based on our implementation, when Locale value is changed, month cells will not be updated and OnMonthCellLoaded event will not be triggered. Only the calendar data will be updated with the new locale language. You can update the month cells when Locale value is changed at runtime by calling Refresh method of calendar. 
 
Regards, 
Dinesh Babu Yadav 


jens de rijcke
Replied On August 16, 2019 06:57 AM UTC

Hi Dinesh Babu Yadav

At my initialize I execute following code:

        private async void SetCalendar()
        {
            language = await SecureStorage.GetAsync(SecureStorageItem.Language);
            if (language == null)
            {
                language = CrossMultilingual.Current.DeviceCultureInfo.TwoLetterISOLanguageName.ToString();
            }
            calendar.Locale = new CultureInfo(language);
        }

Even if I add "calendar.Refresh();" at the end of this void it doesn't get loaded. The initialize is executed for sure because the language is changed. The current month only gets loaded when I go manually two months further or back in time and then I go back to the current month. The other months load as they should. So I do not think it is related with setting the date. It just occurs when I declare the "new MainPage" with "Navigation.PushModalAsync(new MainPage());" or with "App.Current.Mainpage = new NavigationPage(new MainPage());as said before.

Regards,
Jens De Rijcke

Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 19, 2019 01:29 PM UTC

Hi Jens, 
 
Thank you for the update. 
 
Currently, we are analyzing your requirement. We will validate and let you know the details on or before August 21, 2019. We appreciate your patience until then. 
 
Regards,
Subburaj Pandian V  


jens de rijcke
Replied On August 19, 2019 02:05 PM UTC

Hi

Quick update: I see that I've said the following 'So I do not think it is related with setting the date.', I meant 'So I do not think it is related with setting the language'. Just to be clear, my bad. 

Thanks for the time
Regards,
Jens De Rijcke

Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 21, 2019 05:56 AM UTC

Hi Jens,  
  
Thank you for the update.  
  
Based on the provided information, we understand that your requirement is “MonthCellLoaded event not triggered when changing the locale”. As per the calendar implementation MonthCellLoaded event will not be trigger when changing the Locale and for triggering MonthCellLoaded event you must call the Calendar.Refresh() method. We have checked this, and it is working fine as expected from our end.   
  
We have prepared the simple sample with CurrentPage as NavigationPage and changing the Current month BackgroundColor by triggering MonthCellLoaded event when Locale changed dynamically with async locale data. Please refer the sample from following link.  
  
  
We hope that this helps you, if the sample doesn’t meet your requirement kindly modify the sample based on your requirement and revert us with more details, which help us to analyze and provide you solution at the earliest.  
   
Regards,
Subburaj Pandian V  


jens de rijcke
Replied On August 23, 2019 07:26 AM UTC

Hi

I got it working with a little workaround.

The problem was with the loading of the data, it wasn't always ready when the calendar was shown. So I started playing with the refresh & OnMonthCellLoading to place it on different places. I could fill the current month but then the next and previous month didn't load, so on the MonthChangingEvent I refresh the calendar once. At the end of the event I remove the custom made event.
Thanks for the help!

Regards,
Jens De Rijcke

Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 26, 2019 09:33 AM UTC

Hi Jens,   
   
Thank you for the update. We are happy that the mentioned issue resolved at your end.

Please get in touch with us, if you would require any further assistance.  
 
Regards,
Subburaj Pandian V  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon