Scrolling the calendar makes the application to crash

9 posts, 0 answers
  1. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 02 May 2015 Link to this post

    I can't scroll the calendar view, the scroll stops at some point and makes the application to crash, also if I tab on any of the days it makes the app to crash, I have tried even only showing the calendar only in the content of the ContentPage but still the same issue.

     

        StackLayout mainView = new StackLayout
                {
                    Padding = 0,
                    Spacing = 0,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                CustomizeNavigationBar(mainView);

                _calendar = new RadCalendar
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                _calendar.DayNamesDisplayMode = DisplayMode.Show;
                _calendar.TryNavigateToLowerView(true);
                _calendar.WeekNumbersDisplayMode = DisplayMode.Show;

                _calendar.DisplayDateChanged += (s, e) =>
                {
                    // do something  
                };

     

    Any Ideas?

  2. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 02 May 2015 Link to this post

    I can see that the event DisplayDateChanged is gettin called always.

    _calendar.DisplayDateChanged += (s, e) =>
                {
                    // do something
                    Console.WriteLine("test");
                };

     

     

  3. DevCraft banner
  4. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 02 May 2015 Link to this post

    I tried the same thing using xaml but is happening the same thing.
  5. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 04 May 2015 Link to this post

    So I have found the issue and it is related of the language of the device, if  the language of the device is different than English for example Spanish, it makes the calendar to behave different than expected. Any ideas about this? 
  6. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 04 May 2015 Link to this post

    I can see in the docs that localization features are not included in the Xamarin.forms Calendar is there a way we can force English language and not use the current device language?
  7. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 04 May 2015 Link to this post

    Any ideas everyone?
  8. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    551 posts

    Posted 06 May 2015 Link to this post

    Hi Fabio,

    Thank you for contacting us.

    We are aware of this issue, it is related to conversion of DateTime objects in different time zones. We will do our best to fix it for the next release. 

    We have provided an endpoint where you can get the native calendar and further customize it as per your needs. You can take a look at this article from our online documentation that demonstrates how to extend our calendar renderer.

    I hope this helps. Please, let us know if you have further questions.

    Regards,
    Rosy Topchiyska
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  9. Fabio
    Fabio avatar
    20 posts
    Member since:
    Apr 2015

    Posted 07 May 2015 in reply to Rosy Topchiyska Link to this post

    Hello Rosy 

     While trying to create a custom renderer using the code from the docs, I am having this exception.

    "The given key was not present in the dictionary."

     using System;
    using X.Droid;
    using X.Helpers.Renderers;
    using Telerik.XamarinForms.Input;
    using Telerik.XamarinForms.InputRenderer.Android;
    using Xamarin.Forms;
    using Xamarin.Forms.Platform.Android;


    [assembly: ExportRenderer(typeof(CustomCalendar), typeof(CustomCalendarRenderer))]

    namespace X.Droid
    {
        public class CustomCalendarRenderer : CalendarRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs<RadCalendar> e)
            {
                try
                {
                    base.OnElementChanged(e);
                    //var calendarControl = this.Control;
                    //var events = calendarControl.EventAdapter.Events;
                    //if (events.Count > 0)
                    //{
                    //    foreach (var ev in events)
                    //    {
                    //        ev.EventColor = 2;
                    //    }

                    //}

                    //calendarControl.HorizontalScroll = Activated;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    throw;
                }
                
            }
        }
    }

     

  10. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    551 posts

    Posted 12 May 2015 Link to this post

    Hello Fabio,

    I can see that you use a CustomCalendar class, but our CalendarRenderer is designed to work with RadCalendar class. If this does not help you, could you please send us a project that reproduces the issue?

    I look forward to your reply.

    Regards,
    Rosy Topchiyska
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
DevCraft banner