Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
IGCalendarThemeDefinition is not working when the orientation of an device changes
posted

Hi, I'm using Infragistics calendar in Xamarin.iOS. I have a class which defines  Theme Definition for IGCalendar. I have set the HighlightColor to blue color. when we launch the app all the theme definitions of an IGCalendar works perfectly. but once we change the orientation of the device, i don't see any theme definitions working. Observer the HighlightColor changes from blue to red once we change the orientation.

Could any one help me out from this. Thanks in advance.

  • 40030
    Offline posted

    Thanks for the sample!

    The theme property is a weak reference, which means the calendar doesn't store a reference to it. So you need to store a strong reference to it before you assign it.

    So you can do something like this: 

      Theme = _theme = new CalendarThemeDefinition(),


    Here is snippet using your code: 


    CalendarThemeDefinition _theme;
            public override void ViewDidLoad()
            {
                base.ViewDidLoad();
                _appts = GenerateAppointments(2);

                _dataSource = new CalendarDataSource(_appts);
                _dataSources = new NSObject[] { _dataSource };

                _calendar = new IGCalendarView {
                    DisplayBackButton = false,
                    DisplayTitleBar = true,
                    DayViewInitialScrollStartHour = 11,
                    DayViewShowAMPM = true,
                    Frame = this.View.Bounds,
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                    Theme = _theme = new CalendarThemeDefinition(),
                    AppointmentDataSources = _dataSources
                };


    Hope this helps!

    -SteveZ