Skip to main content Skip to footer

A Look at Project Templates in ComponentOne Studio for Xamarin

Most .NET developers discover with their first Xamarin.Forms solution that these apps are much more complicated than what they’ve experienced under the other XAML platforms. The solutions contain multiple projects, involve a variety of NuGet packages, and require interacting with native Xamarin.iOS and Xamarin.Android projects. It can be intimidating to new users and time-consuming for experts. For our 2017 v3 release, we’ve added some new project templates for all supported Xamarin platforms to streamline the process and make development easier.

Since this blog posted in 2017, we've added VS Mac templates and Entity Framework templates! Be sure to visit the ComponentOne Studio for Xamarin page to view all available templates. See all Xamarin templates

What's in a Xamarin Template?

We're offering three varieties of templates for our Xamarin projects to support Xamarin.Forms, Xamarin.iOS, and Xamarin.Android. To use the new templates, all you need to do is install 2017 v3 from our website, and the new templates will become available when you create a new project in Visual Studio 2015 and 2017.

Xamarin Templates

The new templates will streamline the number of steps a developer needs to go through to create a project using ComponentOne Studio for Xamarin controls. First, these projects come with the NuGet packages preloaded for all our controls. This means you won’t need to take any special steps to add our controls to your project. Secondly, these templates also include the initialization necessary for our custom renderers in each platform project. This means that you no longer need to worry about manually initializing these controls for each platform because we’ve already taken care of it. All you need to do is add a license key to your project via our website or the GrapeCity License Manager Add-in.

In Xamarin.Forms, the key can be added to your App.xaml.cs file:

{
   public partial class App : Application
   {
     public App()
     {
       InitializeComponent();
       C1.Xamarin.Forms.Core.LicenseManager.Key = "Add your key here";
       MainPage = new App15.MainPage();
     }

     protected override void OnStart()
     {
       // Handle when your app starts
     }

In Xamarin.Android, it's located in your MainActivity class:

   public class MainActivity : Activity
   {
     protected override void OnCreate(Bundle bundle)
     {
       base.OnCreate(bundle);
       C1.Android.Core.LicenseManager.Key = "Add your key here.";
       // Set our view from the "main" layout resource
       // SetContentView (Resource.Layout.Main);
     }
   }

And in Xamarin.iOS, it's in your AppDelegate class:

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
  C1.iOS.Core.LicenseManager.Key = "Add your key here.";
  // create a new window instance based on the screen size
  Window = new UIWindow(UIScreen.MainScreen.Bounds);

  // If you have defined a root view controller, set it here:
  // Widnow.RootViewController = myViewController;

  // make the window visible
  Window.MakeKeyAndVisible();

  return true;
}

After that, you'll be ready to use the ComponentOne Studio for Xamarin controls.

Future Plans

We’ll be making some future updates to the projects as Xamarin makes changes to their platform. Eventually, we intend to also support Xamarin.Forms applications that use a .NET Standard Library instead of a PCL, since this is the future of cross-platform code. Also, as more platforms are added to Xamarin.Forms, we’ll examine and update the templates as needed. We’re open to user feedback on any features you would like to see added to the templates in the future, so if you have any suggestions, feel free to leave a comment here or in our forums!

Download Now!<%/if%>

Kelley Ricker

comments powered by Disqus