Quick Start Guide for Xamarin.Android

Create a Basic Grid

Start by creating a new solution with an Android Application project:

  1. Click File > New > Solution…
  2. Choose the Android App C# project template
  3. Give the application an App Name: QuickStart and a suitable Identifier (we use com.shinobicontrols.grids.sample.quickstart but you should use your own)
  4. Click Next keeping the other default settings
  5. Choose a suitable location for the solution and click Create

shinobigrids supports Android API 14 and above so if you wish you can modify your project options accordingly:

  1. Click Project > QuickStart Options
  2. On the Build > General page set the Target Framework to Use latest installed platform
  3. On the Build > Android Application page set the Minimum Android version to API level 14 and press OK

Now that you have your new project set up follow the Xamarin Studio import instructions to add a dependency to the shinobigrids library from your application.

Add the ShinobiGridView

Your project will have been created with a layout XML (Resources / layout / Main.axml) file. Modify this to use a ShinobiGridView, by replacing the button element with a ShinobiGridView.

Open the Resources / layout / Main.axml file with the source code editor. Replace the button element with the following:

<com.shinobicontrols.grids.core.ShinobiGridView
    android:id="@+id/my_grid"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

The project will also contain a MainActivity.cs. In its OnCreate method remove the int field called count and the last few lines of code referring to the Button. In its place we are going to obtain a reference to our ShinobiGridView. In the OnCreate method add the following code:

ShinobiGridView shinobiGridView = FindViewById<ShinobiGridView>(Resource.Id.my_grid);

You will also need to add a using statement for the ShinobiControls.Android.Grids.Core namespace.

If you are working with the trial library you will have been given a trial key. You’ll need to set this key on the ShinobiGridView as follows:

shinobiGridView.SetTrialKey("<trial_key_here>");

Make sure you change <trial_key_here> to the trial key you were given!

Note: If you have purchased a licensed version of the library you will not need to set a trial key. If you have purchased a license, please ensure you are referencing the licensed, rather than the trial version of the library within your project.


<< Previous: Quick start introduction | Next: Create some data >>