This is a migrated thread and some comments may be shown as answers.

TelerikForm.Init()

4 Answers 184 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
roy
Top achievements
Rank 1
roy asked on 31 Aug 2016, 04:57 PM

Hello

I am trying to run a very basic App. I simply created a blank Xamarin.Forms app. Then followed the simple steps to add a Telerik Xamarin DataForm.

But when the app reaches this line in the iOS appdelegate file: "return base.FinishedLaunching(app, options);" it says TelerikForms.init must be called after Forms.Init. I add that line but yet i still get the same error.

If i comment out the dataform control in the Main.xaml file the app loads and shows "hellow world".

Any ideas anyone? this is very frustrating to be stuck on the first step.

Everything is the latest version freshly installed (and reinstalled).

Help please! Thanks

Roy

 

4 Answers, 1 is accepted

Sort by
0
roy
Top achievements
Rank 1
answered on 31 Aug 2016, 05:17 PM

is there anywhere else other than here : 

https://github.com/telerik/xamarin-sdk

where you can find complete code samples??

0
Lance | Manager Technical Support
Telerik team
answered on 31 Aug 2016, 07:52 PM
Hi Roy,

Thank you for informing us about the missing section on the DataForm's GettingStarted page.  I have awarded you Telerik Points for this discovery.

The documentation gets updated every Tuesday, so to answer your question directly, you want to add the TelerikForms.Init() method on the AppDelegate.cs file's FinishedLaunching method.

Here's an example:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    global::Xamarin.Forms.Forms.Init();
    Telerik.XamarinForms.Common.iOS.TelerikForms.Init();
    LoadApplication(new App());
 
    return base.FinishedLaunching(app, options);
}


In the future, when starting a new project, you can use our Project Wizard to create all the required files, reference the required libraries, and add the the required Init() calls. This gives you a big head start when creating a Telerik-powered Xamarin Forms application.

thank you for contacting Support and for choosing Telerik by Progress.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Lance | Manager Technical Support
Telerik team
answered on 31 Aug 2016, 08:11 PM
Hello Roy,

I wanted to quickly follow-up with you to make sure you're also aware of the requirement to "new-up" the renderers before making the Init() calls.

Here is the order that is needed to properly initialize the platform specific application, this is true for most custom renderers.

1- Make sure an ExportRendererAttribute is defined for each renderer you're using. (see example below where I use a DataForm and Calendar)
2- You need to new-up the renderer so that it is not optimized out during compilation. this is done before Init calls
3- Call Xamarin.Forms.Forms.Init()
4- Lastly, call TelerikForms.Init()

Here is the completed code snippet highlighting those steps:

// Step 1
[assembly: Xamarin.Forms.ExportRenderer(typeof(Telerik.XamarinForms.Input.RadCalendar), typeof(Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer))]
[assembly: Xamarin.Forms.ExportRenderer(typeof(Telerik.XamarinForms.Input.RadDataForm), typeof(Telerik.XamarinForms.InputRenderer.iOS.DataFormRenderer))]
namespace YOUR.APP.NAMSPACE.IOS
{
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
// Step 2
            new Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer();
            new Telerik.XamarinForms.InputRenderer.iOS.DataFormRenderer();
 
//Step 3
            global::Xamarin.Forms.Forms.Init();
 
//Step 4
            Telerik.XamarinForms.Common.iOS.TelerikForms.Init();
 
            LoadApplication(new Portable.App());
 
            return base.FinishedLaunching(app, options);
        }
 
...
}


Let us know if you have any further questions.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
roy
Top achievements
Rank 1
answered on 01 Sep 2016, 11:34 AM

Hi

Thanks for the reply. 

Step 2 is what was missing. It is also not included in your getting started page. Cost me some hours even though in retrospective is quite obvious ;)

Tags
DataForm
Asked by
roy
Top achievements
Rank 1
Answers by
roy
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or