Search code examples
c#iossyncfusionsfcalendar

How to use ContentPage with UIViewController - VisualStudio IOS


Is there a way to use the ContentPage in a UIViewController?

I'm using SyncFusion SfCalendar that inherits View and i want to show the callendar in my view controller.

    SfCalendar _calendar;
    public CalendarTest(IntPtr handle) : base(handle)
    {
    }

    public override void ViewDidLoad()
    {
        _calendar = new SfCalendar();
        _calendar.OnDateCellHolding += DateCellClicked;

        base.ViewDidLoad();
    }

Solution

  • I have attached the code sample, which added the SFCalendar to ViewController view.

        public override void ViewDidLoad()
        {
            SFCalendar calendar = new SFCalendar();
            base.ViewDidLoad();
            calendar.Frame = new CGRect(0, 0, View.Frame.Width, View.Frame.Height);
            SFMonthViewSettings month = new SFMonthViewSettings();
            month.BorderColor = UIColor.Red;
            calendar.MonthViewSettings = month;
            View.AddSubview(calendar);
    
        }