<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intersoft Solutions Corporate Blog &#187; Cross Platform</title>
	<atom:link href="http://blog.intersoftsolutions.com/tag/cross-platform/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.intersoftsolutions.com</link>
	<description>All about development productivity – ASP.NET, Silverlight, WPF, iOS, Android, Windows Phone, Windows 8</description>
	<lastBuildDate>Sat, 21 Apr 2018 06:57:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.33</generator>
	<item>
		<title>Getting Started with Crosslight Collection Views and Grid Views</title>
		<link>http://blog.intersoftsolutions.com/2015/11/getting-started-with-crosslight-collection-views-and-grid-views-5/</link>
		<comments>http://blog.intersoftsolutions.com/2015/11/getting-started-with-crosslight-collection-views-and-grid-views-5/#comments</comments>
		<pubDate>Thu, 26 Nov 2015 09:32:18 +0000</pubDate>
		<dc:creator><![CDATA[Arief]]></dc:creator>
				<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[kb-how-to-article]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[collection view]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[grid view]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[springboard]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=5483</guid>
		<description><![CDATA[Hi guys, Arief here from the Intersoft Consultant team. Today I will talk about how to use iOS Collection View and Android Grid View in order to create a beautiful cross-platform navigation menu. At the end of this tutorial, you&#8217;ll learn how to use the collection view in [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Result-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="Result" style="float:right; margin:0 0 10px 10px;" /><p>Hi guys, Arief here from the Intersoft Consultant team. Today I will talk about how to use iOS Collection View and Android Grid View in order to create a beautiful cross-platform navigation menu. At the end of this tutorial, you&#8217;ll learn how to use the collection view in your Crosslight applications, which looks similar to the following illustration.</p>
<p><img class="alignnone wp-image-5524 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Result.png" alt="Result" width="865" height="726" /></p>
<h1>Introduction</h1>
<p>Collection View / Grid View (will be referred as <em>Collection View</em> from now on) is a very versatile user interface. As a matter fact, both <em>iOS</em> and <em>Android</em> have always been using it as a native pattern for Springboard (iOS home) as well as lots of other Android launchers. Nowadays those trends start to spread throughout business apps considering how user-friendly and eye-pleasing when compared to the plain old list view.</p>
<p>If you are interested in creating a gorgeous and cool business apps, using collection view is a must! In this tutorial, I will guide you step by step how you can create collection view using the <em>Crosslight style</em>.</p>
<p>Here are the steps that you need to follow:</p>
<ul>
<li>Core Preparation</li>
<li>Assets Preparation</li>
<li>Designing Android Grid View</li>
<li>Designing iOS Collection View</li>
<li>Capturing Selection</li>
</ul>
<p>Without further ado, let&#8217;s get started!</p>
<h1>Preparing the Project</h1>
<p>The first thing you&#8217;ll need is, of course, the project itself. Start by creating a new project using Crosslight Project Wizard and choose the <strong>Blank</strong> template. To do this, from Visual Studio 2012 and upwards, choose <strong>New</strong>, <strong>Project</strong>. From the dialog that appears, choose <strong>Crosslight</strong> and choose to create a new Crosslight application with the <strong>Blank</strong> template. For the purposes of this tutorial, we&#8217;ll name this project: <strong>CollectionView. </strong>Now that you have your project ready, let&#8217;s move on.</p>
<h1>Core Preparation</h1>
<p>Here are several things you need to prepare at the project Core level:</p>
<ul>
<li>Prepare the ViewModel</li>
<li>Prepare the BindingProvider</li>
</ul>
<h2>Prepare the ViewModel</h2>
<p>Begin by creating a new ViewModel in <strong>CollectionView.Core/ViewModels</strong> folder. Simply right-click on the <strong>ViewModels</strong> folder and choose <strong>Add</strong>, <strong>New Item</strong>. We will be repeating this method several times in later sections to add new items to our project, so keep this in mind.</p>
<p><img class="alignnone wp-image-5285 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled1.png" alt="Adding New Item" width="619" height="356" /></p>
<p>Crosslight also ships with built-in item templates that are integrated with Visual Studio, so you can quickly create Crosslight classes right within Visual Studio or Xamarin Studio. In the next dialog that appears, choose <strong>Visual C</strong>#, <strong>Crosslight</strong>, then choose <strong>Crosslight List View Model</strong>. Name this ViewModel as <strong>CollectionViewModel</strong>.</p>
<p><img class="alignnone wp-image-5286 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled2.png" alt="CrosslightListViewModel" width="955" height="582" /></p>
<p>Copy-paste these codes to the newly-created <strong>CollectionViewModel.cs</strong>:</p><pre class="crayon-plain-tag">using Intersoft.Crosslight;
using Intersoft.Crosslight.ViewModels;
using System.Collections.Generic;

namespace CollectionView.Core.ViewModels
{
    public class CollectionViewModel : ListViewModelBase
    {
        #region Constructors

        public CollectionViewModel()
        {
			List items = new List();

			items.Add(new NavigationItem("Ride", typeof(SimpleViewModel)) { Image = "CrosstransRide.png" });
			items.Add(new NavigationItem("Delivery", typeof(SimpleViewModel))  { Image = "CrosstransDeliver.png" });
			items.Add(new NavigationItem("Food", typeof(SimpleViewModel))  { Image = "CrosstransFood.png" });
			items.Add(new NavigationItem("Shop", typeof(SimpleViewModel))  { Image = "CrosstransShop.png" });

			this.SourceItems = items;
        }

        #endregion
    }
}</pre><p>Let&#8217;s take a quick look at the above code. In the constructor of the <strong>CollectionViewModel</strong>, we initialize a list of <strong>NavigationItems</strong> that holds the navigation menus. <strong>NavigationItem</strong> is a very useful class provided by Crosslight that you can utilize to create a menu, as it holds all the common properties you need to create a navigation item. All you have to do is simply populate it with the menu title, image/icon name, and the target <em>ViewModel</em> as navigation target.</p>
<h2>Preparing the BindingProvider</h2>
<p>Next step would be adding a new <strong>Crosslight List Binding Provider</strong> under your <strong>CollectionView.Core/BindingProviders </strong>folder. Give it a name of <strong>CollectionBindingProvider.cs.</strong></p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled3.png"><img class="alignnone wp-image-5289 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled3.png" alt="CrosslightListBindingProvider" width="955" height="582" /></a></p>
<p>And change the code to the following:</p><pre class="crayon-plain-tag">using Intersoft.Crosslight;

namespace CollectionView.Core.BindingProviders
{
    public class CollectionViewBindingProvider : BindingProvider
    {
        #region Constructors

        public CollectionViewBindingProvider()
        {
            ItemBindingDescription itemBinding = new ItemBindingDescription
            {
                DisplayMemberPath = "Title",
                ImageMemberPath = "Image",
                NavigateMemberPath = "Target"
            };

            this.AddBinding("GridView", BindableProperties.ItemsSourceProperty, "Items");
            this.AddBinding("GridView", BindableProperties.ItemTemplateBindingProperty, itemBinding, true);
            this.AddBinding("GridView", BindableProperties.IsBatchUpdatingProperty, "IsBatchUpdating");
            this.AddBinding("GridView", BindableProperties.SelectedItemProperty, "SelectedItem", BindingMode.TwoWay);
            this.AddBinding("GridView", BindableProperties.SelectedItemsProperty, "SelectedItems", BindingMode.TwoWay);
            this.AddBinding("GridView", BindableProperties.IsEditingProperty, "IsEditing", BindingMode.TwoWay);

            this.AddBinding("RefreshButton", BindableProperties.RefreshCommandProperty, "RefreshCommand");

            // navigation
            //this.AddBinding("TableView", BindableProperties.DetailNavigationTargetProperty, new NavigationTarget(typeof(TViewModel)), true);

            // edit commands
            this.AddBinding("AddButton", BindableProperties.CommandProperty, "AddCommand");

            this.AddBinding("DeleteButton", BindableProperties.CommandProperty, "DeleteCommand");
            this.AddBinding("DeleteButton", BindableProperties.CommandParameterProperty, "SelectedItems");
        }

        #endregion
    }
}</pre><p>In the above code, we simply comment out the <strong>DetailNavigationTargetProperty</strong>, as it won&#8217;t be needed because our goal is only to create a navigation menu. It will be needed if you want to create <a href="http://developer.intersoftsolutions.com/display/crosslight/Master-Detail+Navigation">Master-Detail Navigation</a>. We also assign the <strong>MemberPaths </strong>with the properties from <strong>NavigationItem</strong>, such as <strong>ImageMemberPath</strong> for the icon, <strong>DisplayMemberPath</strong> for displaying the title, and <strong>NavigateMemberPath </strong>for the target <em>ViewModel</em> menu. To learn more about Crosslight Binding Provider, check out this <a href="http://developer.intersoftsolutions.com/display/crosslight/Understanding+Binding+Providers">link</a>.</p>
<p><img class="alignnone wp-image-5291 size-medium" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled4-300x71.png" alt="Cave Johnson, We'll done here!" width="300" height="71" /></p>
<p>Your Core is up and ready. Let&#8217;s prepare our assets next.</p>
<h1>Assets Preparation</h1>
<p>Previously in the Binding Provider, you have already specified the <strong>Image</strong> property in <strong>NavigationItem</strong> from <em>ViewModel</em> which contains the filename for the .png file that we will use. When you bind it to the <em>BindableProperties.ImageProperty</em> or <em>ImageMemberPath</em>, it will find the appropriate files to use in<strong> CollectionView.Android/Resources/drawable</strong> or in <strong>CollectionView.iOS/Resources. </strong>So you need to put <a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Image.zip">these files</a> inside both folders because we will be using it for our app&#8217;s interface.<a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/CrosstransFood.png"><br />
</a></p>
<p>Tip: Make sure to optimize the size of your image files. In some phones, images with humongous file size will be ignored and they won&#8217;t show. Okay, since you have finished preparing the assets, let&#8217;s continue to Android GridView!</p>
<h1>Designing Android GridView</h1>
<p>Designing a view for Android is relatively easy and simple. In overall, we&#8217;ll be doing these tasks:</p>
<ul>
<li>Create an Activity for <strong>CollectionActivity</strong>.</li>
<li>Create the view layout.</li>
<li>Define the <strong>ContentLayoutId</strong> and <strong>ItemLayoutId</strong>.</li>
</ul>
<p>To start, simply add a new item and use <strong>Crosslight Android Activity</strong> to get started. Put it inside the <strong>CollectionView.Android/Activities </strong>folder and name it <strong>CollectionActivity.cs</strong>.</p>
<p><img class="gr-progress alignnone wp-image-5293 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled5.png" alt="Crosslight Android Activity" width="955" height="582" /></p>
<p>After your <strong>CollectionActivity</strong> is created, change the contents of the class to the following code.</p><pre class="crayon-plain-tag">using Android.App;
using Intersoft.Crosslight;
using Intersoft.Crosslight.Android;

namespace CollectionView.Android.Activities
{
    [Activity(Label = "Menu")]
    [ImportBinding(typeof(CollectionBindingProvider))]
    public class CollectionActivity : GridActivity
    {
        public override ListViewInteraction InteractionMode
        {
            get{ return ListViewInteraction.Navigation; }
        }

        protected override int ContentLayoutId
        {
            get{ return Resource.Layout.CollectionLayout;}
        }

        protected override int GridItemLayoutId 
        {
	       get{ return Resource.Layout.ItemLayout; }
	    }

        protected override void InitializeView()
        {
            base.InitializeView();
            this.GridView.NumColumns = 2;
        }
    }
}</pre><p>We need to replace the <strong>Activity</strong> with <strong>GridActivity</strong>,<strong> </strong>in<strong> </strong>which then you have more properties to override: <strong>ListViewInteraction</strong>. By overriding the <strong>ListViewInteraction</strong> into <strong>ListViewInteraction.Navigation</strong>, it allows the user to use the grid as a navigation button when an item is tapped.</p>
<p><strong>ContentLayoutId</strong> is also overridden since we want to customize the appearance of our GridView, which we will do in just a moment. The <strong>ItemLayoutId </strong>is overridden to customize the item layout to be used with the GridView. Both <strong>ContentLayoutId</strong> and <strong>ItemLayoutId</strong> refers to Android layout files which exist in the <strong>CollectionView.Android/Resources</strong> folder.</p>
<p>Since we only have two columns for this scenario, we can simply provide the number of columns to show in the overridden <strong>InitializeView</strong> method by setting <strong>this.GridView.NumColumns </strong>to <strong>2</strong>. The advantage of using this method is: you actually don&#8217;t need to specify the width of the Grid. The <em>GridActivity</em> automatically adjusts the optimal number of items by taking account the viewport width.</p>
<p>Earlier, we&#8217;ve specified the <strong>ContentLayoutId</strong> and <strong>ItemLayoutId</strong> in our Activity. Now let&#8217;s create those layouts. You will need to create two layouts inside <strong>CollectionView.Android/Resources/layout </strong>folder using <em>Android Layout</em> item template. We will name it <strong>CollectionLayout.axml</strong> &amp; <strong>ItemLayout.axml.</strong></p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/AndroidLayout1.png"><img class="alignnone size-full wp-image-5531" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/AndroidLayout1.png" alt="AndroidLayout" width="955" height="582" /></a></p>
<p>Here&#8217;s the code for <strong>CollectionLayout.axml</strong> and <strong>ItemLayout.axml</strong> respectively.</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/CrosstransBg"
    android:minWidth="25px"
    android:minHeight="25px"&gt;
    &lt;LinearLayout
        android:orientation="horizontal"
        android:layout_marginBottom="25dp"
        android:layout_marginTop="50dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout1"
        android:gravity="center_horizontal"&gt;
        &lt;ImageView
            android:src="@drawable/CrosstransLogo"
            android:layout_width="wrap_content"
            android:layout_height="100dp"
            android:id="@+id/imageView1" /&gt;
    &lt;/LinearLayout&gt;
    &lt;GridView
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_margin="20dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:verticalSpacing="20dp"
        android:horizontalSpacing="20dp"
        android:id="@+id/GridView" /&gt;
&lt;/LinearLayout&gt;</pre><p>From the designer&#8217;s view, the <strong>CollectionLayout </strong>looks like the following:</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/CollectionLayout1.png"><img class="alignnone size-full wp-image-5544" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/CollectionLayout1.png" alt="CollectionLayout" width="728" height="574" /></a></p>
<p>and here&#8217;s the contents for <strong>ItemLayout.axml</strong>:</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:minWidth="25px"
    android:minHeight="25px"
    android:background="#CC2368C0"
    android:gravity="center_horizontal"&gt;
    &lt;LinearLayout
        android:orientation="vertical"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:id="@+id/linearLayout1"
        android:gravity="center_horizontal|center_vertical"&gt;
        &lt;ImageView
            android:src="@android:drawable/ic_menu_gallery"
            android:scaleType="centerCrop"
            android:adjustViewBounds="true"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:id="@+id/ImageView" /&gt;
    &lt;/LinearLayout&gt;
    &lt;TextView
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:id="@+id/TextLabel"
        android:gravity="center_horizontal" /&gt;
&lt;/LinearLayout&gt;</pre><p>From the designer&#8217;s view, it looks like this:</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/ItemLayout.png"><img class="alignnone size-full wp-image-5545" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/ItemLayout.png" alt="ItemLayout" width="726" height="569" /></a></p>
<p>In summary, what I do in <strong>CollectionLayout.axml</strong> is setting the background for the page, add a header, and provide enough spacing between GridView items. The most important things to note is I&#8217;ve defined the GridView id,  <strong>@+id/GridView. </strong>The will be the reference that we defined in <em>BindingProvider</em> to the property in <em>ViewModel, </em>so make sure the id name is right!</p>
<p>We will be doing a similar task with<strong> ItemLayout.axml</strong>, where we assign both <strong>ImageView</strong> to the <strong>Image</strong> Property in <em>ViewModel</em> and <strong>TextView</strong> to <strong>Title</strong> Property in <em>ViewModel</em>. By default, Crosslight provides two built-in ids for showing an image and a text for item template, which has the name <em>ImageView</em> and <em>TextLabel</em> respectively. But if you want to add additional view elements to the item template, then you can simply add a new binding definition in the binding provider like this which must be done in BindingProvider:</p><pre class="crayon-plain-tag">itemBinding.AddBinding ("CustomView", BindableProperties.TextProperty, "Title");</pre><p>Run the project. You should get a result similar to the following:</p>
<div style="width: 300px; " class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-5483-1" width="300" height="0" loop="1" autoplay="1" preload="metadata" controls="controls"><source type="video/mp4" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_09_11_14.mp4?_=1" /><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_09_11_14.mp4">http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_09_11_14.mp4</a></video></div>
<p>Next, let&#8217;s create the iOS version.</p>
<h1>Designing iOS CollectionView</h1>
<p>Similar to Android, building <strong>CollectionView</strong> on iOS follows a pretty similar path:</p>
<ul>
<li>Create a ViewController for MainCollectionView.</li>
<li>Create the cell and the header.</li>
<li>Set the outlets.</li>
</ul>
<p>Let&#8217;s start from the ViewController. Add a new item using <strong>Crosslight</strong><strong> iOS Collection View Controller </strong>template<strong> </strong>and put it inside your <strong>CollectionView.iOS/ViewControllers </strong>folder and name it <strong>MainCollectionView.cs</strong>.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-26-at-5.16.58-PM.png"><img class="alignnone wp-image-5505 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-26-at-5.16.58-PM.png" alt="MainViewController" width="721" height="550" /></a></p>
<p>This is the code for the ViewController.</p><pre class="crayon-plain-tag">using CollectionView.ViewModels;
using CollectionView;
using Intersoft.Crosslight;
using Intersoft.Crosslight.iOS;
using Foundation;
using UIKit;

namespace CollectionView.iOS
{
	[Register ("MainCollectionView")]
	[ImportBinding (typeof(CollectionBindingProvider))]
	public class MainCollectionView : UICollectionViewController
	{
		#region Constructors

		public MainCollectionView ()
			: base ("MainCollectionView", null)
		{
		}

		#endregion

		#region Properties

		public override UIViewTemplate CellTemplate {
			get { return new UIViewTemplate (CollectionViewCell.Nib); }
		}

		public override CollectionViewInteraction InteractionMode {
			get { return CollectionViewInteraction.Navigation; }
		}

		public override bool ShowSectionHeader {
			get { return true; }
		}

		public override UIViewTemplate SectionHeaderTemplate {
			get { return new UIViewTemplate(CollectionHeader.Nib); }
		}

		#endregion

		#region Methods

		protected override void InitializeView ()
		{
			base.InitializeView ();

			this.NavigationItem.Title = "Home";
                        UIImageView backView = new UIImageView(UIImage.FromFile ("CrosstransBg.png")); 
                        backView.ContentMode = UIViewContentMode.ScaleAspectFill; 
                        this.CollectionView.BackgroundView = backView;
			// Register Views
			this.RegisterViewIdentifier ("GridView", this.CollectionView);
		}

		#endregion
	}
}</pre><p>Let&#8217;s take a look at some of the overridden methods and properties.</p>
<ul>
<li><strong>CellTemplate</strong>: This property is the equivalent of Android&#8217;s <strong>ItemLayoutID</strong>, which will define the view to be used as navigation item inside the Collection View.</li>
<li><strong>InteractionMode</strong>: This method is the equivalent of Android&#8217;s <strong>ListViewInteraction</strong>, that defines the interaction when users tap on the navigation item.</li>
<li><strong>SectionHeader &amp; SectionHeaderTemplate</strong>: It will be used to specify the header for the Collection View.</li>
<li><b>InitializeView</b>: This method is called when the view is initialized. Here, we set the background view of the Collection View. Afterward, <em>this.RegisterViewIdentifier (&#8220;GridView&#8221;, this.CollectionView); </em>is used to associate the Collection View with the <strong>GridView</strong> view identifier to be used by the Binding Provider.</li>
</ul>
<p>Now your view controller is done! Next, we&#8217;ll create the <em>CollectionView</em> <em>Header</em> and <em>Cells</em>. Inside your <strong>CollectionView.iOS/Views</strong>, add 2 new items: <strong>Crosslight iOS Collection Cell</strong>, we will name it <strong>CollectionViewCell.cs </strong>(feel free to choose between iPhone or iPad) and <strong> Crosslight iOS Collection View Group Header</strong> which we will name it <strong>CollectionHeader.cs.</strong></p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-10.33.53-AM.png"><img class="alignnone wp-image-5506 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-10.33.53-AM.png" alt="CollectionViewCell" width="719" height="548" /></a></p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-10.34.49-AM.png"><img class="alignnone wp-image-5507 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-10.34.49-AM.png" alt="CollectionHeader" width="719" height="549" /></a></p>
<p>If you check back your <strong>MainCollectionView.cs</strong>, you can see that both <strong>CollectionViewCell.Nib</strong> <strong>&amp; CollectionHeader.Nib are</strong> now detected. The Nib represents both .cs files that we&#8217;ve created before. However, we won&#8217;t touch any codes, instead we will play around with the layout using iOS XCode.</p>
<p>Let&#8217;s first open the <strong>MainCollectionView.xib</strong> inside your <strong>CollectionView.iOS/Views</strong> using Apple XCode. Inside the Document Outline, you can select <em>File&#8217;s Owner</em>, then the Identity Inspector will change according to what  you selected. Specify the Custom Class as <strong>MainCollectionView</strong>.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/asdsadsa.png"><img class="alignnone size-full wp-image-5508" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/asdsadsa.png" alt="Files Owner" width="261" height="128" /></a>  <a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-10.46.08-AM.png"><img class="alignnone wp-image-5509 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-10.46.08-AM.png" alt="MainViewControllerClass" width="257" height="434" /></a></p>
<p>Using the Connections Inspector, control + drag the <em>view</em> from Outlets to the Collection View to set the outlet, as shown in the following illustration.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/MainCollectionView.png"><img class="alignnone size-large wp-image-5546" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/MainCollectionView-1024x231.png" alt="MainCollectionView" width="604" height="136" /></a></p>
<p>Then, in the File Inspector, turn off Auto Layout.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/turnoffautolayout1.png"><img class="alignnone wp-image-5513 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/turnoffautolayout1.png" alt="turnoffautolayout" width="260" height="391" /></a></p>
<p>In the Size Inspector, specify the cell&#8217;s width and height, also adjusting the auto-resizing behaviors so that it will layout nicely when the device is rotated.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/CollectionViewConfiguration.png"><img class="alignnone wp-image-5514 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/CollectionViewConfiguration.png" alt="CollectionViewConfiguration" width="260" height="665" /></a></p>
<p>Now you are done configuring your <strong>MainCollectionView.xib.</strong></p>
<p>Let&#8217;s continue to <strong>CollectionViewCell.xib</strong>, in this case, you don&#8217;t need to worry about  your <strong>File&#8217;s Owner</strong>,  Simply drag and drop a <strong>Label</strong> and <strong>ImageView</strong> from the Object Library to the view.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/viewchoice.png"><img class="alignnone wp-image-5515 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/viewchoice.png" alt="viewchoice" width="262" height="491" /></a></p>
<p>Select your Label (or anything in your designer interface), Press the conjoined circle button on the right top. A panel with codes will appear, this is the <strong>Assistant Editor</strong> which will help you create Binding without having you to code anything.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/ConjoinedCircle.png"><img class="alignnone wp-image-5516 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/ConjoinedCircle.png" alt="ConjoinedCircle" width="698" height="421" /></a></p>
<p>Next, let&#8217;s set the outlets using the Assistant Editor. Select your <strong>CollectionViewCell.m</strong> and change it to <strong>CollectionViewCell.h</strong>, control + drag your <strong>Label</strong> into the panel and give it <strong>TextLabel</strong> as a name, then set the <strong>ImageView</strong> outlet with the name of <strong>ImageView</strong>.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/ctrldrop.png"><img class="alignnone wp-image-5517 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/ctrldrop.png" alt="ctrldrop" width="881" height="417" /></a></p>
<p>You need to turn off the auto layout from both image, label, and their parent to use auto resizing. Here&#8217;s what I&#8217;ve done to each of them:</p>
<ul>
<li><strong>View</strong>: Change the background color, turn on the horizontal and vertical scaling so that it won&#8217;t grow or shrink when the display rotates.</li>
<li><strong>TextLabel</strong>: Change the alignment to the middle,  Pin it to the bottom using auto resizing and change the width to 120 and height to 50</li>
<li><strong>ImageView</strong>: Change the view mode to Aspect fit, turn on the horizontal and vertical arrow inside auto-resizing, and changes the width and height to 60</li>
</ul>
<p>In <strong>CollectionHeader.xib</strong>, what we do is just drag and drop an ImageView. Here are the settings for ImageView:</p>
<ul>
<li>Change the image with CrosstransLogo.png,</li>
<li>View Mode to Aspect Fit,</li>
<li>Width = 150,</li>
<li>Turn on the horizontal and vertical arrow inside auto resizing</li>
</ul>
<p>Here is the result:</p>
<div style="width: 300px; " class="wp-video"><video class="wp-video-shortcode" id="video-5483-2" width="300" height="0" loop="1" autoplay="1" preload="metadata" controls="controls"><source type="video/mp4" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Crosstransios.mp4?_=2" /><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Crosstransios.mp4">http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Crosstransios.mp4</a></video></div>
<p>Your app is pretty much done, but we still ned to capture what user has selected.</p>
<h1>Capturing Selection</h1>
<p>In this section, we&#8217;ll learn how to capture selection made when the user taps on any of the navigation items.</p>
<p>If you recall earlier, we&#8217;ve defined how our <em>CollectionView</em> should navigate, which is done in our <em>BindingProvider </em>in the <strong>NavigateMemberPath </strong>inside using <strong>ItemBindingDescription</strong>.</p><pre class="crayon-plain-tag">ItemBindingDescription itemBinding = new ItemBindingDescription
            {
                DisplayMemberPath = "Title",
                ImageMemberPath = "Image",
                NavigateMemberPath = "Target"
            };</pre><p>As you are aware, each <em>MemberPath</em> represents the component of our menu. In fact, it also contains the whole data associated with the specific Item you choose from the list that you have created in your <em>ViewModel</em> back then.</p><pre class="crayon-plain-tag">public CollectionViewModel()
        {
			List items = new List();

			items.Add(new NavigationItem("Ride", typeof(SimpleViewModel)) { Image = "CrosstransRide.png" });
			items.Add(new NavigationItem("Delivery", typeof(SimpleViewModel))  { Image = "CrosstransDeliver.png" });
			items.Add(new NavigationItem("Food", typeof(SimpleViewModel))  { Image = "CrosstransFood.png" });
			items.Add(new NavigationItem("Shop", typeof(SimpleViewModel))  { Image = "CrosstransShop.png" });

			this.SourceItems = items;
        }</pre><p>BindingProvider will obtain the target of your navigation, represented by <em>typeof(SimpleViewModel))</em>. However even though we already successfully navigate,  in our case each of our Item have the same Navigation target. What if we want to know which item/menu is selected? Here is how:</p>
<p>When you navigate to a new <em>ViewModel</em>, the <strong>Navigated</strong> method is called in the target <em>ViewModel</em>, and it contains the <strong>sender</strong> value which holds the information of the caller <em>ViewModel</em>. For the simplicity of this tutorial, we&#8217;ll change the <em>SimpleViewModel</em> to handle user input. Let&#8217;s change our <strong>SimpleViewModel.cs </strong>(CollectionView.Core/ViewModels folder):</p><pre class="crayon-plain-tag">using Intersoft.Crosslight;
using Intersoft.Crosslight.Input;
using Intersoft.Crosslight.ViewModels;

namespace CollectionView.ViewModels
{
    public class SimpleViewModel : ViewModelBase
    {
        #region Fields

        private string _footerText;
        private string _greetingText;
        private string _newText;

        #endregion

        #region Properties

        public string FooterText
        {
            get { return _footerText; }
            set
            {
                if (_footerText != value)
                {
                    _footerText = value;
                    OnPropertyChanged("FooterText");
                }
            }
        }

        public string GreetingText
        {
            get { return _greetingText; }
            set
            {
                if (_greetingText != value)
                {
                    _greetingText = value;
                    OnPropertyChanged("GreetingText");
                }
            }
        }

        public string NewText
        {
            get { return _newText; }
            set
            {
                if (_newText != value)
                {
                    _newText = value;
                    OnPropertyChanged("NewText");
                }
            }
        }

        public DelegateCommand ShowToastCommand { get; set; }

        #endregion

        #region Constructors

        public SimpleViewModel()
        {
            IApplicationContext context = this.GetService().GetContext();
            if (context.Platform.OperatingSystem == OSKind.Android)
                this.GreetingText = "Hello Android from Crosslight!";
            else if (context.Platform.OperatingSystem == OSKind.WinPhone)
                this.GreetingText = "Hello WinPhone from Crosslight!";
            else if (context.Platform.OperatingSystem == OSKind.WinRT)
                this.GreetingText = "Hello WinRT from Crosslight!";
            else if (context.Platform.OperatingSystem == OSKind.iOS)
                this.GreetingText = "Hello iOS from Crosslight!";

            this.FooterText = "Powered by Crosslight®";
            this.ShowToastCommand = new DelegateCommand(ShowToast);
        }

        #endregion

        #region Methods

        public override void Navigated (NavigatedParameter parameter)
        {
            if (parameter.Sender is CollectionViewModel) 
            {
                this.ToastPresenter.Show("You are choosing: " + (parameter.Sender as CollectionViewModel).SelectedItem.Title);
            }
        }

        private void ShowToast(object parameter)
        {
            this.ToastPresenter.Show("You entered: " + this.NewText);
            this.GreetingText = this.NewText;
        }

        #endregion
    }
}</pre><p>The menu that user chooses will be represented by <strong>SelectedItem </strong>and there are two things to note here: <strong>SelectedItem</strong> actually obtained from the<strong> sender ViewModel</strong> which is from <em>CollectionViewModel.cs</em> and <strong>SelectedItem</strong> actually the default property provided from <em>CollectionViewModel</em> implementing the <strong>ListViewModelBase</strong>. In this case, we will show a toast presenter to indicate which menu the user has chosen, by obtaining the <strong>Title</strong> of <strong>SelectedItem </strong>and show it using Toast Presenter.</p>
<p>Also, If you put a breakpoint in the highlighted line above and inspect the <strong>NavigatedParameter</strong>,<strong> </strong>you can see from the shot below that it holds lots of information not only the <strong>SelectedItem </strong>but the whole CollectionViewModel.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Content.png"><img class="alignnone wp-image-5500 size-full" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Content.png" alt="Debugger Content" width="571" height="488" /></a></p>
<p>You will use this neat trick to accomplish a lot of cool things using Crosslight, so don&#8217;t forget to save this favourite this blog for later uses. Okay, now let&#8217;s run our project!</p>
<p>Wait&#8230; should we also change the Android and iOS? <strong>No need at all</strong> using Crosslight you only need to change it in Core and it will be applied to each platform, very convenient! Here is the result:</p>
<div style="width: 300px; " class="wp-video"><video class="wp-video-shortcode" id="video-5483-3" width="300" height="0" loop="1" autoplay="1" preload="metadata" controls="controls"><source type="video/mp4" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_14_23_41.mp4?_=3" /><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_14_23_41.mp4">http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_14_23_41.mp4</a></video></div>
<div style="width: 300px; " class="wp-video"><video class="wp-video-shortcode" id="video-5483-4" width="300" height="0" loop="1" autoplay="1" preload="metadata" controls="controls"><source type="video/mp4" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/crosstransfull.mp4?_=4" /><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/crosstransfull.mp4">http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/crosstransfull.mp4</a></video></div>
<h1>Wrapping Up</h1>
<p>With Crosslight, you will never have to worry about the code behind the scene. However, in  this session, I want to emphasize the customizability of Crosslight, using minimal effort and codes we already successfully create a simple and gorgeous navigation menu. I believe the next steps for you is to discover more about Crosslight features and we still have more tutorials coming in the futures! So stay tuned with us and have fun!</p>
<p>You can find the source code for this post here: <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightcollectionview/browse">http://git.intersoftsolutions.com/projects/CT/repos/crosslightcollectionview/browse</a></p>
<p>See you in the next post,<br />
Arief Handany</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2015/11/getting-started-with-crosslight-collection-views-and-grid-views-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_09_11_14.mp4" length="4544727" type="video/mp4" />
<enclosure url="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Crosstransios.mp4" length="1532667" type="video/mp4" />
<enclosure url="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/2015_11_27_14_23_41.mp4" length="13983430" type="video/mp4" />
<enclosure url="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/crosstransfull.mp4" length="3605056" type="video/mp4" />
		</item>
		<item>
		<title>Extending Crosslight Form Builder</title>
		<link>http://blog.intersoftsolutions.com/2015/11/extending-crosslight-form-builder-2/</link>
		<comments>http://blog.intersoftsolutions.com/2015/11/extending-crosslight-form-builder-2/#comments</comments>
		<pubDate>Tue, 17 Nov 2015 07:00:18 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Reference Samples]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[form builder]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=5101</guid>
		<description><![CDATA[Since you’ve managed to get started with Crosslight Form Builder, let’s move on a bit to see how we can extend the capabilities of the Crosslight Form Builder beyond its original capabilities. In this post we’re going to learn how to add an option to [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled.001-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="Untitled.001" style="float:right; margin:0 0 10px 10px;" /><p>Since you’ve managed to <a href="http://blog.intersoftsolutions.com/2015/11/getting-started-with-crosslight-form-builder/">get started with Crosslight Form Builder</a>, let’s move on a bit to see how we can extend the capabilities of the Crosslight Form Builder beyond its original capabilities. In this post we’re going to learn how to add an option to choose the driver in <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightformbuilder/browse">CrosslightFormBuilder sample</a>, as well as showing a custom view with the driver’s photo in the form, with the driver&#8217;s phone number, which when tapped, will initiate a call to the driver.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled.001.png"><img class="alignnone size-large wp-image-5108" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Untitled.001-1024x768.png" alt="Untitled.001" width="604" height="453" /></a></p>
<p>&nbsp;</p>
<p>There are two major enhancements to be done:</p>
<ul>
<li>Providing driver selection</li>
<li>Providing custom driver view</li>
</ul>
<h1>Providing Driver Selection</h1>
<p>Let&#8217;s try to create the <strong>Driver</strong> selection. At a quick overview, here&#8217;s a list of subtasks to be done in order to achieve this functionality:</p>
<ul>
<li>Prepare the <strong>Driver</strong> model</li>
<li>Prepare the <strong>Driver Repository</strong> that populates the list of drivers.</li>
<li>Prepare the <strong>DriverListViewModel </strong>that populates the items from the repository.</li>
<li>Update the <strong>Form Metadata </strong>and connect the <strong>DriverListViewModel</strong>.</li>
</ul>
<p>Let&#8217;s go through each one, step-by-step.</p>
<h2>Prepare the Driver model</h2>
<p>To create the <strong>Driver</strong> model, let&#8217;s create a new file named <em>Driver.cs</em> under <strong>CrosslightFormBuilder.Core/Models</strong> folder. The contents are as follows.</p><pre class="crayon-plain-tag">#region Usings

using CrosslightFormBuilder.Models;

#endregion

namespace CrosslightFormBuilder.Core.Models
{
    public class Driver : ModelBase
    {
        #region Constructors

        public Driver(int id, string name, string phone, byte[] image)
        {
            this.Id = id;
            this.Name = name;
            this.Phone = phone;
            this.Image = image;
        }

        #endregion

        #region Fields

        private int _id;
        private byte[] _image;
        private string _name;
        private string _phone;

        #endregion

        #region Properties

        public int Id
        {
            get { return _id; }
            set
            {
                if (_id != value)
                {
                    _id = value;
                    OnPropertyChanged("Id");
                }
            }
        }

        public byte[] Image
        {
            get { return _image; }
            set
            {
                if (_image != value)
                {
                    _image = value;
                    OnPropertyChanged("Image");
                }
            }
        }

        public string Name
        {
            get { return _name; }
            set
            {
                if (_name != value)
                {
                    _name = value;
                    OnPropertyChanged("Name");
                }
            }
        }

        public string Phone
        {
            get { return _phone; }
            set
            {
                if (_phone != value)
                {
                    _phone = value;
                    OnPropertyChanged("Phone");
                }
            }
        }

        #endregion
    }
}</pre><p>The Driver model contain 4 MVVM-ready properties: <strong>ID</strong> (<em>int</em>), <strong>Image</strong> (<em>byte[]</em>), <strong>Name </strong>(<em>string</em>), and <strong>Phone</strong> (<em>string</em>). That&#8217;s basically it. I&#8217;ve also prepared a constructor for quick and easy initialization. Now your Driver model is ready. Let&#8217;s move on.</p>
<h2>Prepare the Driver Repository</h2>
<p>Upon reading the heading, you might have two questions: What is this repository thingy and why do I need it? The repository pattern is more of a best-practice design pattern that handles the actual data processing for your applications. A data repository for your app.</p>
<p>For example, right now your app might currently retrieve data by performing queries to a database server, then one day you decided to change the data retrieval process. Rather than making changes to each and every <em>ViewModel</em>, you can do so by just replacing the data repository. No changes in ViewModel needed. To learn more about the Repository Pattern, check out our Developer Center documentation <a href="http://developer.intersoftsolutions.com/display/crosslight/Repository+Pattern">here</a>.</p>
<p>So, let&#8217;s get started in creating our <strong>Driver repository</strong>. First thing you need to do is define the interfaces needed for the repository. Create a new interface in <em>CrosslightFormBuilder.Core/ModelServices</em>, named <strong>IDataRepository.cs</strong>, also creating the folder as necessary. The contents of the file are as follows.</p><pre class="crayon-plain-tag">public interface IDataRepository&lt;TEntity, in TKey&gt; where TEntity : class
{
    #region Methods

    TEntity Get(TKey id);
    IEnumerable&lt;TEntity&gt; GetAll();

    #endregion
}</pre><p>We&#8217;ll prepare an interface to get the <em>Driver</em> entity based on the given ID. Notice that everything is defined as generic here. Also another interface to return all entities when calling <em>GetAll()</em> method.</p>
<p>Proceed by creating the interface for the <em>Driver</em> repository in <em>CrosslightFormBuilder.Core/ModelServices </em>folder, named <strong>IDriverRepository.cs</strong>, also creating the folder as necessary.</p><pre class="crayon-plain-tag">public interface IDriverRepository : IDataRepository&lt;Driver, int&gt;
{
    #region Methods

    Driver GetByName(string name);

    #endregion
}</pre><p>There&#8217;s nothing much to see here, we simply added a new method to get the <em>Driver</em> entity by the driver&#8217;s <em>Name </em>by subclassing the previously created <em>IDataRepository</em> interface. Let&#8217;s move on by creating the concrete <em>DriverRepository</em> implementation. Create a new file called <strong>DriverRepository.cs </strong>inside <em>CrosslightFormBuilder.Core/ModelServices</em> folder.</p><pre class="crayon-plain-tag">public class DriverRepository : IDriverRepository
{
    #region Properties

    public List&lt;Driver&gt; _items { get; set; }

    #endregion

    #region Methods

    public Driver Get(int id)
    {
        return this.GetAll().FirstOrDefault(o =&gt; o.Id == id);
    }

    public IEnumerable&lt;Driver&gt; GetAll()
    {
        if (_items == null)
        {
            _items = new List&lt;Driver&gt;();
            _items.Add(new Driver(1, "John", "+123456", this.GetType().Assembly.GetManifestResourceStream("CrosslightFormBuilder.Core.Assets.john.png").ToByte()));
            _items.Add(new Driver(2, "Brad", "+134567", this.GetType().Assembly.GetManifestResourceStream("CrosslightFormBuilder.Core.Assets.brad.png").ToByte()));
            _items.Add(new Driver(2, "Charles", "+145678", this.GetType().Assembly.GetManifestResourceStream("CrosslightFormBuilder.Core.Assets.charles.png").ToByte()));
        }

        return _items;
    }

    public Driver GetByName(string name)
    {
        return this.GetAll().FirstOrDefault(o =&gt; o.Name == name);
    }

    #endregion
}</pre><p>Here, you can then provide the real implementation to retrieve the list of drivers, also getting the drivers by name and ID. The highlighted line shows how the list of <em>Drivers</em> are populated, by utilizing the constructor we&#8217;ve provided for our <em>Driver</em> model earlier. Also notice that we&#8217;ve provided the image to be used for each driver. Oh yeah, before we forget, let&#8217;s go ahead and use these images for the drivers and put it inside the <strong>CrosslightFormBuilder.Core/Assets</strong> folder, also creating the folder as needed.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/brad.png"><img class=" size-full wp-image-5118 alignleft" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/brad.png" alt="brad" width="200" height="200" /></a>  <a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/charles.png"><img class=" size-large wp-image-5119 alignleft" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/charles.png" alt="charles" width="200" height="200" /></a>  <a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/john.png"><img class=" size-large wp-image-5120 alignleft" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/john.png" alt="john" width="200" height="200" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Make sure that these images&#8217; <em>BuildAction</em> is set to <em>EmbeddedResource</em> so that they can be used in your application. Also, if you try to build the project now, you might get an error on the <em>ToByte()</em> method. To fix this, create a new file that contains an extension method to convert a <em>Stream</em> to array of bytes. Create a file named <em>StreamExtensions.cs, </em>and put it inside the <strong>CrosslightFormBuilder.Core/Extensions</strong> folder.</p><pre class="crayon-plain-tag">public static class StreamExtensions
{
    #region Methods

    public static byte[] ToByte(this Stream input)
    {
        using (MemoryStream ms = new MemoryStream())
        {
            input.CopyTo(ms);
            return ms.ToArray();
        }
    }

    #endregion
}</pre><p>A handy tip for you: these extension method provides an easy way to extend the functionalities of a certain class, that is reusable within your application. For example, if you wish to create an extension, for let&#8217;s say, converting a <em>string </em>to a <em>byte[]</em>, you can definitely do something similar to this.</p>
<p>Now that you&#8217;ve the got the repository part ready, let&#8217;s hook it up to the <em>ViewModel</em>.</p>
<h2>Prepare the DriverListViewModel</h2>
<p>Start by creating a new ViewModel file called <strong>DriverListViewModel.cs</strong> and put it inside <strong>CrosslightFormBuilder.Core/ViewModels</strong> folder. Here&#8217;s the contents of the file.</p><pre class="crayon-plain-tag">public class DriverListViewModel : ListViewModelBase&lt;Driver&gt;
{
    #region Constructors

    public DriverListViewModel()
    {
        this.SourceItems = this.Repository.GetAll().ToObservable();
    }

    #endregion

    #region Properties

    private IDriverRepository Repository
    {
        get
        {
            if (Container.Current.CanResolve&lt;IDriverRepository&gt;())
                return Container.Current.Resolve&lt;IDriverRepository&gt;();
            return new DriverRepository();
        }
    }

    #endregion
}</pre><p>Here, we populate the <em>SourceItems</em> when the <strong>DriverListViewModel</strong> is constructed, just by calling the previously created <em>GetAll()</em> method from our interface. Also notice that we&#8217;ve provided the <em>Repository</em> property which is resolved upon the property&#8217;s getter. This is also called as <em>IoC</em> (Inversion of Control). To use the <em>IoC</em> pattern, you&#8217;ll need to register the previously created <em>DriverRepository</em> to be used globally in the application. To do this, open up the <strong>AppService.cs</strong> file in the <em>CrosslightFormBuilder.Core/Infrastructure</em> folder and add this line in the constructor.</p><pre class="crayon-plain-tag">public CrosslightAppAppService(IApplicationContext context) : base(context)
{
    Container.Current.Register&lt;IDriverRepository, DriverRepository&gt;().WithLifetimeManager(new ContainerLifetime());
}</pre><p>Your <em>ViewModel</em> is now ready to be used to populate the list of <em>Drivers</em>.</p>
<h2>Update the FormMetadata</h2>
<p>Since you already have the list of drivers properly populated from the DriverListViewModel, we&#8217;ll need to modify the <strong>OrderFormMetadata</strong> a bit. From the initial <strong>OrderFormMetadata </strong>class in the <em>Order.cs </em>file, let&#8217;s modify the <strong>TaxiChoiceSection</strong> class to include the driver selection.</p><pre class="crayon-plain-tag">public class TaxiChoiceSection
{
    #region Fields

    [Display(Caption = "Car Type")]
    [Editor(EditorType.AutoDetect)]
    [Layout(Style = LayoutStyle.RightDetail)]
    public CarType CarType;

    [Editor(EditorType.Selection)]
    [SelectedItemBinding(Path = "Driver")]
    [Binding(Path = "Driver.Name")]
    [SelectionInput(SelectionMode.Single, DisplayMemberPath = "Name", ListSourceType = typeof(DriverListViewModel))]
    public Driver Driver;

    [Display(Caption = "Airport?")]
    [Editor(EditorType.Switch)]
    [Layout(Style = LayoutStyle.RightDetail)]
    public bool IsAirport;

    #endregion
}</pre><p>The highlighted lines above shows the added definition for the driver selection. Let&#8217;s inspect this line by line.</p>
<ul>
<li><em>[Editor(EditorType.Selection)]</em><br />
This determines which editor type to be used.<br />
<a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/selection.002.png"><img class="alignnone size-large wp-image-5122" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/selection.002-1024x768.png" alt="selection.002" width="604" height="453" /></a></li>
<li><em>[SelectedItemBinding(Path = &#8220;Driver&#8221;)]</em><br />
This attribute determines which binding path for the selected item used in the Form Builder. In this case, the item for the Form Builder is of type <strong>Order</strong>, which has the <strong>Driver</strong> property. That&#8217;s where we&#8217;re going to bind our selection into. (<strong>OrderViewModel.Item.Driver</strong>)</li>
<li><em>[Binding(Path = &#8220;Driver.Name&#8221;)]</em><br />
The <strong>BindingAttribute</strong> determines which property of the <strong>Driver</strong> model that is going to be displayed in the form after selection has completed.<br />
<a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/binding.png"><img class="alignnone size-full wp-image-5123" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/binding.png" alt="binding" width="491" height="232" /></a></li>
<li><em>[SelectionInput(SelectionMode.Single, DisplayMemberPath = &#8220;Name&#8221;, ListSourceType = typeof(DriverListViewModel))]</em><strong><br />
</strong>The <strong>SelectionInputAttribute </strong>determines the selection editor behavior, which <em>ViewModel</em> provides the items source for the list, as well as the property to be displayed on the list of selection, or also often known as <strong>DisplayMemberPath</strong>.<br />
<a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/selection-editor.png"><img class="alignnone size-full wp-image-5124" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/selection-editor.png" alt="selection editor" width="476" height="192" /></a></li>
</ul>
<p>By now, you&#8217;ve successfully provided a driver selection for the Form Builder. How about adding the custom view on the bottom of the form?</p>
<h1>Providing Custom Driver View</h1>
<p>After the user has selected the driver, it&#8217;s best for us to show the driver that the user has selected by providing a custom view at the bottom of the form. Let&#8217;s learn how you can use a custom view resource to be used along with the Form Builder, complete with data binding capabilities. In overall, there are several steps needed to achieve this:</p>
<ul>
<li>Provide the custom driver view for iOS</li>
<li>Update the Form Metadata</li>
<li>Provide the Binding Provider</li>
<li>Bind to ViewModel</li>
<li>Provide the custom driver view for Android</li>
</ul>
<p>Let&#8217;s go through each step, one-by-one.</p>
<h2>Provide the Custom Driver View for iOS</h2>
<p>To provide the custom driver view for iOS, all you need to do is creating a new Crosslight view for iPhone. To do this, you can utilize the item template shipped with Crosslight. In your iOS project, in the <em>Views</em> folder, right-click and add a new file. Under <strong>Crosslight</strong>, choose <strong>Crosslight iOS View for iPhone</strong>.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-13-at-6.27.32-PM.png"><img class="alignnone size-large wp-image-5125" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-13-at-6.27.32-PM-1024x669.png" alt="Screen Shot 2015-11-13 at 6.27.32 PM" width="604" height="395" /></a></p>
<p>Let&#8217;s give it a name of <strong>CallDriverButton</strong>. What this will do is Crosslight will create two files, namely <strong>CallDriverButton.xib</strong> and <strong>CallDriverButton.cs</strong>. All you need to do is create a new layout by opening the <strong>CallDriverButton.xib</strong> in <em>Xcode Interface Builder</em>.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/xcode-interface-builder.png"><img class="alignnone size-large wp-image-5126" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/xcode-interface-builder-1024x282.png" alt="xcode-interface-builder" width="604" height="166" /></a></p>
<p>Create your layout any way you want it. Just create an <em>ImageView</em>, a <em>Label</em>, and a <em>Button</em>.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/outlet1.png"><img class="alignnone size-full wp-image-5128" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/outlet1.png" alt="outlet" width="1021" height="449" /></a></p>
<p>Set the outlet for each.</p>
<ul>
<li><strong>ImageView</strong>: DriverImage</li>
<li><strong>Label</strong>: DriverName</li>
<li><strong>Button</strong>: CallButton</li>
</ul>
<p>I know, my layout looks awful. But all I really want to show you is how you can inject your own custom views into the form using the Form Builder. So, after your layout&#8217;s done, save it and go back to Xamarin Studio.</p>
<h2>Update the Form Metadata</h2>
<p>Now that your layout is done, let&#8217;s update our <strong>OrderFormMetadata</strong> a bit to include this new view in our form layout. Open up <strong>Order.cs</strong>, and let&#8217;s create a new section and call it <strong>CallDriverSection</strong>, or anything you want.</p><pre class="crayon-plain-tag">public class CallDriverSection
{
    [Editor(EditorType.Custom, CustomEditorIdentifier = "CallDriverButton")]
    public object CallDriver;
}</pre><p>Now I&#8217;d like you to pay attention how easy it is to embed a custom view into a Crosslight Form. From the definition above, you can see that we simply set the editor type to custom, then set the <strong>CustomEditorIdentifier</strong> set to <strong>CallDriverButton</strong>. In iOS, this corresponds to the name of the XIB that we&#8217;ve defined for our custom view. While on Android, this also corresponds to the name of the Android Layout file we&#8217;ve defined for our custom view layout. Simple as that.</p>
<blockquote><p>We&#8217;ve made it super easy for developers to create a beautiful platform-specific data form by combining robust pre-built editors for common input and flexible custom views for more complex user interface. This allows you to mix and match what works best for you, and let Crosslight do the magic at runtime.</p></blockquote>
<p>After you&#8217;ve created this section, let&#8217;s add this at the bottom of our form.</p><pre class="crayon-plain-tag">[Form(Title = "Order Form")]
public class OrderFormMetadata
{
    #region Fields

    [Section(Header = "Passenger Details")]
    public PassengerDetailsSection PassengerDetails;

    [Section(Header = "Taxi Choice")]
    public TaxiChoiceSection TaxiChoiceSection;

    [Section]
    public CallDriverSection CallDriverSection;

    #endregion
}</pre><p>You&#8217;re done with the form metadata. But there&#8217;s something missing. What about those outlets we&#8217;ve defined earlier? How can we bind data to it?</p>
<h2>Provide the Binding Provider</h2>
<p>Simple. It&#8217;s basically the way you would do any data binding with Crosslight. Yes, you should provide a <strong>BindingProvider</strong> for the form. In addition to automatic bindings, Form Builder also supports natural data binding process through the use of <strong>BindingProvider</strong>. In this case, let&#8217;s create a new <strong>BindingProvider</strong> called <strong>OrderBindingProvider.cs</strong>. Let&#8217;s put this under <strong>CrosslightFormBuilder.Core/BindingProviders</strong> folder. The contents of the <strong>OrderBindingProvider</strong> are as follows.</p><pre class="crayon-plain-tag">public class OrderBindingProvider : BindingProvider
{
    #region Constructors

    public OrderBindingProvider()
    {
        this.AddBinding("DriverImage", BindableProperties.ImageProperty, "Item.Driver.Image");
        this.AddBinding("DriverName", BindableProperties.TextProperty, "Item.Driver.Name");
        this.AddBinding("CallButton", BindableProperties.TextProperty, "Item.Driver.Phone");
        this.AddBinding("CallButton", BindableProperties.CommandProperty, "CallCommand");
    }

    #endregion
}</pre><p>Here, we&#8217;ve simply used the outlets we&#8217;ve defined earlier and bind them automatically to the selected Driver in the form. We&#8217;ve also added a binding from the <strong>CallButton</strong> to the <strong>CallCommand</strong> in the ViewModel, which can be used to call the driver immediately upon click. And don&#8217;t forget to use the newly created <strong>OrderBindingProvider</strong> in your <strong>OrderViewController</strong>.</p>
<blockquote><p>Again, Crosslight does a lot of magic behind the scene which enables you to define data binding in such a simple definition. Looking back, we just need to create a view, define the outlets, and provide the bindings. Crosslight takes care the connection between all those layers at runtime.</p></blockquote>
<p></p><pre class="crayon-plain-tag">[Register("OrderViewController")]
[ImportBinding(typeof(OrderBindingProvider))]
public class OrderViewController : UIFormViewController&lt;OrderViewModel&gt;
{
    ...
}</pre><p></p>
<h2>Bind to ViewModel</h2>
<p>Afterwards, in the <strong>OrderViewModel</strong>, we simply add a new DelegateCommand for the phone number.</p><pre class="crayon-plain-tag">public class OrderViewModel : EditorViewModelBase&lt;Order&gt;
{
    #region Properties

    /// &lt;summary&gt;
    /// Gets the type of the form metadata associated to the editor.
    /// &lt;/summary&gt;
    /// &lt;value&gt;
    /// The type of the form metadata.
    /// &lt;/value&gt;
    public override Type FormMetadataType
    {
        get { return typeof(OrderFormMetadata); }
    }
    
    public DelegateCommand CallCommand { get; set; }

    #endregion
    
    #region Constructors
    
    public OrderViewModel()
    {
        this.CallCommand = new DelegateCommand(ExecuteCall);
    }
    
    #endregion

    #region Methods
    
    private void ExecuteCall(object obj)
    {
        this.MobileService.Telephony.Call(this.Item.Driver.Phone);
    }

    /// &lt;summary&gt;
    /// Executes the save command.
    /// &lt;/summary&gt;
    /// &lt;param name="parameter"&gt;Parameter.&lt;/param&gt;
    protected override void ExecuteSave(object parameter)
    {
        this.Validate();

        if (!this.HasErrors)
        {
            StringBuilder passengerDetails = new StringBuilder();
            passengerDetails.Append("Name: " + this.Item.Name + "\n");
            passengerDetails.Append("Pickup Time: " + this.Item.PickupTime + "\n");
            passengerDetails.Append("Going to the airport? " + this.Item.IsAirport + "\n");
            passengerDetails.Append("Car Type: " + this.Item.CarType + "\n");
            passengerDetails.Append("Driver: " + this.Item.Driver.Name);

            this.MessagePresenter.Show(passengerDetails.ToString(), "Confirm Order", new[] {"Yes", "No"}, selection =&gt;
            {
                if (selection == 0) //Yes
                {
                    this.ToastPresenter.Show("Your order has been placed.");
                }
                else
                {
                    this.ToastPresenter.Show("You cancelled the order.");
                }
            });
        }
        else
        {
            this.MessagePresenter.Show(this.ErrorMessage);
        }

    }
    

    /// &lt;summary&gt;
    /// Called when this instance is navigated.
    /// &lt;/summary&gt;
    /// &lt;param name="parameter"&gt;Parameter.&lt;/param&gt;
    public override void Navigated(NavigatedParameter parameter)
    {
        base.Navigated(parameter);

        this.Item = new Order();
        this.Item.PickupTime = DateTime.Now;
    }

    #endregion
}</pre><p>Everything seems pretty much the same, except for the additional <strong>CallCommand</strong> we&#8217;ve defined for the <strong>CallButton</strong>. Run the project and you should now see iOS version is now working properly. Try selecting a driver and that driver detail will be automatically shown in the custom view you&#8217;ve defined. When you run this on an iPhone, you can even immediately perform a phone call to the driver&#8217;s number directly.</p>
<div style="width: 400px; " class="wp-video"><video class="wp-video-shortcode" id="video-5101-5" width="400" height="360" loop="1" autoplay="1" preload="auto" controls="controls"><source type="video/mp4" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/iOS.mp4?_=5" /><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/iOS.mp4">http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/iOS.mp4</a></video></div>
<p>&nbsp;</p>
<p>What about Android?</p>
<h2>Provide the Custom Driver View for Android</h2>
<p>This is where the Form Builder excels. Since you&#8217;ve completed the iOS version, all you need to do is just provide the custom layout and use the previously created <strong>OrderBindingProvider</strong>. Let&#8217;s take a look how to achieve this.</p>
<p>First, create a new Android Layout file by right clicking on the <strong>CrosslightFormBuilder.Android/Resources/layout</strong> folder. Then choose <strong>Add</strong>, <strong>New Item</strong>. Select <strong>Android, Layout</strong>. Remember to give it a name of <strong>CallDriverButton</strong>, as this corresponds to the <strong>CustomViewIdentifier</strong> defined in the FormMetadata earlier.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-13-at-9.49.39-PM.png"><img class="alignnone size-large wp-image-5134" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-13-at-9.49.39-PM-1024x579.png" alt="Screen Shot 2015-11-13 at 9.49.39 PM" width="604" height="342" /></a></p>
<p>Provide the layout as follows.</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"&gt;
    &lt;LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"&gt;
        &lt;ImageView
            android:id="@+id/DriverImage"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:layout_gravity="center" /&gt;
        &lt;TextView
            android:id="@+id/DriverName"
            android:layout_width="wrap_content"
            android:layout_height="20sp"
            android:layout_gravity="center" /&gt;
        &lt;Button
            android:id="@+id/CallButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" /&gt;
    &lt;/LinearLayout&gt;
&lt;/RelativeLayout&gt;</pre><p>After ensuring the IDs are correct, you&#8217;re only left to hook up the <strong>OrderBindingProvider</strong> in your <strong>OrderActivity</strong>. Let&#8217;s do that now.</p><pre class="crayon-plain-tag">[Activity(Label = "Order Form")]
[ImportBinding(typeof(OrderBindingProvider))]
public class OrderActivity : FormActivity&lt;OrderViewModel&gt;
{
    ...
}</pre><p>You&#8217;re done. Run the project and you&#8217;ll get the same result with iOS version.</p>
<div style="width: 400px; " class="wp-video"><video class="wp-video-shortcode" id="video-5101-6" width="400" height="360" loop="1" autoplay="1" preload="auto" controls="controls"><source type="video/mp4" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Android.mp4?_=6" /><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Android.mp4">http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Android.mp4</a></video></div>
<p>&nbsp;</p>
<p>Beautiful, isn&#8217;t it?</p>
<h1>Wrapping Up</h1>
<p>The entire project for this tutorial can be found <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightformbuilderextended/browse">here</a>. To use this sample, you&#8217;ll need to use at least Crosslight <a href="http://git.intersoftpt.com/projects/CROS/repos/updates/browse/Crosslight4_0_5000_321">4.0.5000.321</a> and above. Hopefully this will help you learn more about the Crosslight Form Builder.</p>
<p>You&#8217;ve seen how you can easily inject a custom view to the form by using the ViewResource custom editor. Probably some time in the future I&#8217;ll add a custom ViewBuilder tutorial as well. This will be very useful for those of you who wants to build a custom control that works seamlessly with the FormBuilder. We&#8217;ve also used this approach in building Crosslight Form Builder for each platform inside Crosslight framework.</p>
<p>Cheers,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2015/11/extending-crosslight-form-builder-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/iOS.mp4" length="608488" type="video/mp4" />
<enclosure url="http://blog.intersoftsolutions.com/wp-content/uploads/2015/11/Android.mp4" length="562423" type="video/mp4" />
		</item>
		<item>
		<title>Crosslight 2.3 Adds Cross Platform Localization Service and Major Stability Improvements</title>
		<link>http://blog.intersoftsolutions.com/2014/07/crosslight-2-3-adds-cross-platform-localization-service-and-major-stability-improvements/</link>
		<comments>http://blog.intersoftsolutions.com/2014/07/crosslight-2-3-adds-cross-platform-localization-service-and-major-stability-improvements/#comments</comments>
		<pubDate>Wed, 30 Jul 2014 18:00:59 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2014 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Localization]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[New Releases]]></category>
		<category><![CDATA[Service Pack 1]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Xamarin]]></category>

		<guid isPermaLink="false">http://intersoftpt.wordpress.com/?p=3796</guid>
		<description><![CDATA[We are truly excited to announce that the ultimate cross-platform development toolset now sports even more features and stability updates. This new service pack update includes a new localizable business template, over 50+ item templates for Visual Studio, dynamic localization service, new template definitions for iOS, major stability [...]]]></description>
				<content:encoded><![CDATA[<img width="466" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/new-crosslight-project-wizard_thumb31-604x350.png" class="attachment-post-thumbnail wp-post-image" alt="New Crosslight Project Wizard" style="float:right; margin:0 0 10px 10px;" /><p>We are truly excited to announce that the ultimate cross-platform development toolset now sports even more features and stability updates. This new service pack update includes a new localizable business template, over 50+ item templates for Visual Studio, dynamic localization service, new template definitions for iOS, major stability updates for Android, support for application-wide single sign-on, and much more.</p>
<p>The Crosslight Project Wizard now includes an additional and noteworthy template, which is the localizable business template. The new localizable business template allows you to change the language of the application dynamically at runtime, thanks to the dynamic localization service. If automatic language is set, when the device&#8217;s language is set to the one supported by the application, then the language changes automatically. However, you can also force an application to use a specific language of your choice, regardless of the language setting used by the device. The following screenshots show the improved Crosslight Project Wizard and the running app respectively.</p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/07/new-crosslight-project-wizard3.png"><img title="New Crosslight Project Wizard" src="https://intersoftpt.files.wordpress.com/2014/07/new-crosslight-project-wizard_thumb3.png" alt="New Crosslight Project Wizard" width="625" height="444" border="0" /></a></p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/07/banner-developer-crosslight2-update-eng-jap-narrow-copy1.png"><img title="banner-developer-crosslight2-update-eng-jap-narrow copy" src="https://intersoftpt.files.wordpress.com/2014/07/banner-developer-crosslight2-update-eng-jap-narrow-copy_thumb1.png" alt="banner-developer-crosslight2-update-eng-jap-narrow copy" width="625" height="482" border="0" /></a></p>
<p>We have also shipped more than 50 templates for Visual Studio, ranging for variety of projects, this includes, Android, iOS, Windows Phone, and shared Core project. The templates itself is clear and concise, with instructions inside each template on how to use it. Your development process will be significantly accelerated since you can now quickly add common Crosslight items to your project. Say goodbye to the tedious, error-prone copy and paste.</p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/07/2-copy1.png"><img title="2 copy" src="https://intersoftpt.files.wordpress.com/2014/07/2-copy_thumb1.png" alt="2 copy" width="625" height="366" border="0" /></a></p>
<p>In addition, Crosslight for Android platform has received major stability improvements, including the support of <a href="https://components.xamarin.com/view/xamandroidsupportv4-18" target="_blank">Xamarin.Android.Support.v4 library</a>, revamped overall lifecycle, elegant rotation handling to ensure that view state is restored without performance degradation, improved tab caching, and reliability of the Android services, such as camera service, location service, social services, and more.</p>
<p>So far, we&#8217;ve only touched the surface of what&#8217;s revamped in this SP1 release. For a complete list of the updates, make sure you check out the Crosslight 2.3 release notes in our <a href="http://developer.intersoftpt.com/display/crosslight/Crosslight+2.0+Update+3+Release+Notes" target="_blank">Developer Center page</a>.</p>
<p>All the installers on our site have also been updated to reflect the new bits. Of course, this update is free of charge for customers with existing subscription for Mobile Studio or Premier Studio. Click <a href="http://www.intersoftpt.com/account">here</a> to sign in and access your downloads. If you haven&#8217;t tried Crosslight today, <a href="http://intersoftpt.com/requesttrial" target="_blank">request a trial now</a> and see how Crosslight transform the way you build cross-platform apps entirely.</p>
<p>Last but not last, we hope you enjoy Crosslight as much as we love building it! Stay tuned for our upcoming video tutorials and hands-on guide to apply these exciting features in your apps!</p>
<p>Cheers,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2014/07/crosslight-2-3-adds-cross-platform-localization-service-and-major-stability-improvements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding Design Patterns for Cross Platform Mobile Development</title>
		<link>http://blog.intersoftsolutions.com/2014/06/understanding-design-patterns-for-cross-platform-mobile-development/</link>
		<comments>http://blog.intersoftsolutions.com/2014/06/understanding-design-patterns-for-cross-platform-mobile-development/#comments</comments>
		<pubDate>Tue, 03 Jun 2014 15:43:32 +0000</pubDate>
		<dc:creator><![CDATA[Jimmy Petrus]]></dc:creator>
				<category><![CDATA[2014 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false">http://intersoftpt.wordpress.com/?p=3739</guid>
		<description><![CDATA[Since the inception of Crosslight last year, we have seen a number of approaches which attempt to address cross-platform development, particularly on the native mobile platforms. We have received frequently asked questions regarding the best practices for cross-platform mobile development, and what would be the [...]]]></description>
				<content:encoded><![CDATA[<img width="478" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/mvvm_simple_thumb1.png" class="attachment-post-thumbnail wp-post-image" alt="MVVM Pattern" style="float:right; margin:0 0 10px 10px;" /><p>Since the inception of Crosslight last year, we have seen a number of approaches which attempt to address cross-platform development, particularly on the native mobile platforms. We have received frequently asked questions regarding the best practices for cross-platform mobile development, and what would be the ideal solution for building cross-platform apps that are highly flexible, maintainable and extensible. Since then, we have helped a lot of our customers understanding the design patterns which allow them to better architect their solutions. In this blog post, I will share some insights based on our past successful experiences.</p>
<p>There are various approaches in designing cross-platform solution depending on the development goals. At the simplest, you can come up with basic code sharing solution without applying design pattern, i.e., through file linking to each platform-specific project. However, that will be definitely less-than-ideal and is not recommended. In this blog post, I’ll be focusing on approaches with applied design pattern such as unified view abstraction pattern and ViewModel pattern.</p>
<h1>Unified View Abstraction Pattern</h1>
<p>This design pattern comes from the idea that the user-interface element (View) in each platform can be unified into a single intermediate API that reside in the shared project. The intermediate View API represents only the abstraction of the View, while the actual implementation is done at each platform behind the scene. The unification of the View seems interesting and promising at a glance, but it actually exposes more problems than the gained benefits.</p>
<p>One of the biggest problems is that view abstraction pattern makes sense only if the user interaction logic is defined within the View implementation itself. The nature of this pattern commonly disregards the separation of concern (SoC) between the user interaction logic and the view implementation — which is very similar to outdated patterns such as WinForms. This means that your application and user interaction logic will be “tightly coupled” to the view.</p>
<p>To help you understand it better, see the following code snippet which shows an example of a View implemented with this pattern.</p>
<p></p><pre class="crayon-plain-tag">public class ItemDetailPage : DetailPage
{
    public ItemDetailPage()
    {
	public MainPage ()
	{
 	    var panel = new Panel();
	    var label = new Label();
	    var button = Button() { Text = “Click me!” };

	    button.Clicked += (sender, e) =&gt; 
		{
		    label.Text = “Button clicked”;
   		};

	    panel.Children.Add(label);
	    panel.Children.Add(button);
			
	    Page = panel;
	}
    }
}</pre><p></p>
<p>As seen in the code above, the application and user interaction logic are tightly coupled to the view definition, mostly through event handlers. With such design, we can quickly identify some of the major limitations and design issues such as:</p>
<ul>
<li><strong>Limited UI Definitions</strong> — the impact of the design creates limitation in which only the lowest common denominations of the features across platforms are supported. It’s obvious that you cannot easily leverage the feature available only in certain platform.
<li><strong>Poor Maintainability</strong> — the code is hard to maintain and extend since logics are coupled to the view.
<li><strong>Not Testable</strong> — Functional layer cannot be unit tested since the implementation requires event initiated from the actual user interface elements.
<li><strong>Not Designable</strong> — View definition must be done with hand-coding to comply with the intermediate View API. There are typically no designer support for such view abstraction.
<li><strong>Not Scalable</strong> — As view is defined through code, all works are done by developers, including both coding and implementing the design. You cannot have a design team specialized in implementing the iOS screen, while another separate team implementing Android screen.
<li><strong>Low Adaptability</strong> — Changing views will often breaking functionality since the application logic is coupled to the view. As the results, modifying views can be tedious, complex, and commonly break the existing code, for instance, consider changing a list view into a collection view.</li>
</ul>
<p>It is tempting to think that you can also create Model and ViewModel layers to use in conjunction with the unified view pattern. However, doing so brings us back to zero degree. Applying the view abstraction pattern will be pointless when you find yourself needing to create extra layers. So it’s an one-off approach — you can choose to apply the unified view pattern with the imposed limitations and design drawbacks, or choose the ViewModel pattern that emphasize on strong separation of concerns principle.</p>
<p>That said, the view abstraction pattern is actually one that we avoided at best since the first day we laid out our apps infrastructure and components design. Our architect team never consider this approach as a feasible solution due to the limitations and issues it brought. Unless you are implementing super simple apps that do not concern on code’s maintainability, testability and extensibility; you should avoid building cross-platform apps with this pattern.</p>
<h1>ViewModel (MVVM) Pattern Comes to Rescue</h1>
<p>An ideal cross-platform development based on our years of experience in building cross-platform apps and tools is to adapt the <a href="en.wikipedia.org/wiki/SOLID_(object-oriented_design)" target="_blank">SOLID</a> principle in our design pattern. The principles suggest the architectural pattern to be designed in ways that produce the following results:</p>
<ul>
<li>Low coupling between layers, high cohesion within them.
<li>Separation of concerns, user interaction logic and view should be implemented in separate layers, resulting in greater code maintainability, testability, extensibility and scalability.
<li>User interface (View) layer should contain no business or interaction logic, enabling changes or modification to the views without affecting user interaction logic.
<li>Business/application logic layer contains no user interface (view) and don’t refer to any of the view layers.</li>
</ul>
<p>It is imperative to conform to these principles if your goal is to create great cross-platform apps that are highly scalable, maintainable, and can be easily scaled at times.</p>
<p>One of the popular design patterns today called Model-View-ViewModel (MVVM) allows you to achieve most of the principles described above. By nature, MVVM separates the user interaction logic out from the view layer, but still cohesive within them through the use of two-way data binding. This enables you to easily implement the user interaction logic in a separate layer called ViewModel — without concerning the views. Likewise, you can flexibly design the views without concerning or fearing to break the functional logic. This makes MVVM pattern one of the most appealing solutions for cross-platform development.</p>
<p>The following diagram illustrates a typical architecture implementation with MVVM design pattern.</p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/06/mvvm_simple.png"><img title="MVVM Pattern" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="MVVM Pattern" src="https://intersoftpt.files.wordpress.com/2014/06/mvvm_simple_thumb.png" width="572" height="323"></a></p>
<p>The only issue with this pattern is that you require a seriously solid MVVM framework and tools that are built with the MVVM pattern. This includes the frameworks for the ViewModels, dependency delegation, event aggregators, commands, as well as View components that support data binding and the ViewModel paradigm.</p>
<p>Well, the good news is that we’ve got you covered. Read on.</p>
<h2>Cross Platform Mobile Development Done Right</h2>
<p>By now, you should already have insights what’s the most ideal solution for building cross-platform apps. Applying a design pattern is required to build highly successful one, and choosing the right design pattern is crucial in determining the future of the apps.</p>
<p>When our team engineered Crosslight last year, we decided to build it on a solid design pattern — one that can serve as a foundation for mission critical apps. We chosen MVVM, not only because it’s real good, but because we have great success in building cross-platform tools with it. And more importantly, we’ve helped countless of enterprise customers building highly successful apps with this pattern. We’ve experienced it, and seen how development team get real results — clear responsibility, improved productivity and accelerated development speed.</p>
<p>Instead of unifying the heterogenous views across different platforms into a single API, Crosslight lets you build cross-platform mobile apps in the most natural way possible. You write the user interaction logic code entirely in ViewModel, while freely designing the view in each IDE of the platform. The view doesn’t contain any UI logic, so the designer team is free to unleash their creativity to build great user experiences that matter on each platform. It’s the best of three worlds — developers, designers, and users.</p>
<p>The following illustrations show how a Crosslight view is designed in iOS and Android respectively:<br /><a href="https://intersoftpt.files.wordpress.com/2014/06/ios-designer.png"><img title="iOS Designer" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="iOS Designer" src="https://intersoftpt.files.wordpress.com/2014/06/ios-designer_thumb.png" width="577" height="393"></a></p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/06/android-designer.png"><img title="Android Designer" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Android Designer" src="https://intersoftpt.files.wordpress.com/2014/06/android-designer_thumb.png" width="554" height="393"></a></p>
<p>As seen in the above screenshots above, you can easily design the view and layout to your liking – all within your favorite IDE. More importantly, you can access all the properties and modify them conveniently in a flick of finger. In contrast, accessing platform-specific properties is something you’re limited to do with unified view abstraction pattern.</p>
<p>The comprehensive data binding support in Crosslight means that you are free to use any existing controls available in your toolbox, arrange and size them the way you want, and set the behaviors and appearance settings the way you desire. As long as the ID matches the binding definition, everything will work beautifully at runtime. No new API to learn. No code required for implementing design. It just works.</p>
<p>With MVVM, Crosslight offers great benefits not available in other solutions such as:</p>
<ul>
<li>Targets multiple platforms at once (efficiency)
<li>High code reusability (maintainability)
<li>Great native user experiences (usability)
<li>High extensibility (customizability)
<li>Loosely-coupled components (testability, scalability)</li>
</ul>
<p>To learn more about Crosslight architecture and how it applies the MVVM design pattern, see <a href="developer.intersoftpt.com/display/crosslight/Crosslight+Architectural+Overview" target="_blank">Understanding Crosslight Architecture</a>.</p>
<p>To see Crosslight in action with the supported MVVM capabilities, download the MVVM Samples <a href="http://git.intersoftpt.com/projects/CROS/repos/samples/browse/MvvmSamples" target="_blank">here</a>.</p>
<h2>Fostering Innovative Design, Yet Sharing Single Codebase</h2>
<p>While building cross-platform apps, you want to reuse as much code as possible, from the domain models, data access layer, to the application and user interface logic. Yep, we got that! Crosslight allows you to share 100% of these code base, thanks to the solid architecture. And even better, you don’t have to sacrifice the design and user experiences of each platform. Building apps with great user experiences is arguably the most important aspect particularly in native mobile platforms.</p>
<p>One of the features that our developers love the most is the ability to instantly change the user interface elements (view) without breaking any of the existing business and interaction logic. In short, you can have a single ViewModel and have it presented in various type of views. That’s just one of the many benefits of using MVVM pattern.</p>
<p>For example, consider you have a list of items displayed with a table view on the phone. Later, you realized that it doesn’t look so good in the tablet and wish to change it to a collection view. You can easily achieve such scenarios with Crosslight since it embraces the MVVM design pattern. Thinking to use unified view abstraction to achieve this simple goal? Good luck with that : )</p>
<p>The following illustration shows the list view on the iPhone and collection view on the iPad — all done in a single ViewModel.</p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/06/table-view.png"><img title="Table View" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Table View" src="https://intersoftpt.files.wordpress.com/2014/06/table-view_thumb.png" width="222" height="393"></a></p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/06/collection-view.png"><img title="Collection View" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Collection View" src="https://intersoftpt.files.wordpress.com/2014/06/collection-view_thumb.png" width="494" height="393"></a></p>
<p>As seen in the above illustrations, creating great experiences that are unique for each platform and even for each device kind becomes so straightforward and manageable, thanks to the MVVM pattern which emphasizes clear separation of concerns. More than just static user interface elements, Crosslight ships dozens of UI components that are optimized with native user experiences – such as the one shown in iPad screenshot above.</p>
<p>You can download the Inventory samples <a href="http://git.intersoftpt.com/projects/CROS/repos/samples/browse/MyInventory" target="_blank">here</a> and try it for yourself. Seeing is believing.</p>
<h1>Wrapping Up</h1>
<p>So far, I have only scratched the surface of the benefits of MVVM design pattern, and how Crosslight is built to leverage it to the fullest. Notably, applying a solid design pattern is crucial in apps development, particularly if you are targeting cross-platform. Hopefully this post gives you inspirations and better insights in understanding design patterns for cross- platform development.</p>
<p>You can quickly get started and learn more from the <a href="http://developer.intersoftpt.com/" target="_blank">Crosslight Developer Center</a>. In the next blog, I will discuss more UI goodness included in Crosslight, which features to use for particular scenarios, and how you can use them together to build great apps experiences.</p>
<p>Best,<br />Jimmy</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2014/06/understanding-design-patterns-for-cross-platform-mobile-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Crosslight Adds Full iOS 7 Support and New UI Features</title>
		<link>http://blog.intersoftsolutions.com/2013/10/crosslight-adds-full-ios-7-support-and-new-ui-features/</link>
		<comments>http://blog.intersoftsolutions.com/2013/10/crosslight-adds-full-ios-7-support-and-new-ui-features/#comments</comments>
		<pubDate>Wed, 02 Oct 2013 16:07:15 +0000</pubDate>
		<dc:creator><![CDATA[Jimmy Petrus]]></dc:creator>
				<category><![CDATA[2013 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iOS7]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[UI Design]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=3485</guid>
		<description><![CDATA[It’s just a few weeks ago that we released Premier Studio 2013, our best release ever. Today, we’re pleased to announce our first update to Crosslight, our flagship cross-platform native mobile development tools. In case you missed the news, the 2013 release delivers a wide-range [...]]]></description>
				<content:encoded><![CDATA[<img width="466" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/ios7_3_thumb21-604x350.png" class="attachment-post-thumbnail wp-post-image" alt="Form Builder Redesigned for iOS 7" style="float:right; margin:0 0 10px 10px;" /><p>It’s just a few weeks ago that we released Premier Studio 2013, our best release ever. Today, we’re pleased to announce our first update to Crosslight, our flagship cross-platform native mobile development tools. In case you missed the news, the 2013 release delivers a wide-range of exciting new tools across current lineups such as ASP.NET, Silverlight, and WPF – as well as the expansion to new mobile platforms including iOS, Android, Windows Phone 8 and Windows 8. Check out the complete details <a href="http://www.intersoftpt.com/2013">here</a>.</p>
<p>In this update, Crosslight adds full support for iOS 7, Apple’s latest mobile operating system. Unlike HTML-based mobile tools, Crosslight adheres to the strict iOS 7 user experience and design guidelines which includes upgrade to the beautiful look and feel, tint color, translucency, ultra-smooth animation, and much more. In this blog post, I’d like to share the new enhancements and changes specifically for iOS 7 that we’ve made in this update.</p>
<h1>Gorgeous Form Editor. Redesigned for iOS 7.</h1>
<p>Apple’s latest iOS 7 is the most significant overhaul since its first inception which delivers dramatic changes to the user interface and user experience aspects in addition to many other new features. One of the biggest changes is the introduction of translucent and motion to create beautiful interface with sense of depth in favor to heavier, real-life illustration design. If you’re a UI/UX designer, like us, this means it’s time to upgrade your design skillset and rework your iOS mobile apps.</p>
<p>The iOS 7’s new interface design is so interesting in how it makes minimal design looks not only great – but done right and well balanced. With translucent, hair-line precise rendering, yet incredibly stunning visual effects, iOS 7 redefines the experiences of modern apps. The first in the industry, the entire user interface components in Crosslight are now upgraded to adhere to the iOS modern experience, including the form builder, navigation controls and nearly 20+ editing controls. See the following illustration for details.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/10/ios7_32.png"><img title="Form Builder Redesigned for iOS 7" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Form Builder Redesigned for iOS 7" src="http://intersoftpt.files.wordpress.com/2013/10/ios7_3_thumb2.png" width="627" height="460"></a></p>
<p>As seen in the above visual, Crosslight’s Form Builder now leverages the new design elements and guidelines introduced in iOS 7. This includes improvements to the composite layout which sports minimal design and fluid entry layout similar to the Contacts app. </p>
<p>It also introduces a gorgeous circular photo mask which you can easily enable with a property set, and revamped picker components presentation which show the picker inline to the form field in favor to the modal view. The inline picker presentation is proven to be more intuitive than the modal view as users can conveniently select an item and scroll without dismissing the selection. In addition, when users opened another picker, the previous displayed picker will be smoothly hidden with transition – delivering elegant user experiences similar to the built-in Calendar app.</p>
<h1>Every Detail. Meticulously Considered.</h1>
<p>Apple’s revamped interface design in iOS 7 is thoughtfully-designed in every little detail. As the leading component provider for Apple’s platforms, we leverage the new visual changes in every detail too. In only a week timeframe, we redesigned every UI component, pixel-by-pixel, to match the new design principles and guidelines introduced in iOS 7. For instances, the form builder design that produced for the smaller screen such as iPhone – should look great not only in the iPhone, but in the iPad as well, in either modal view or popover view, in either portrait or landscape orientation – and in any scenarios you could think of.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/10/ios7_42.png"><img title="Every detail is considered in Crosslight for iOS 7" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Every detail is considered in Crosslight for iOS 7" src="http://intersoftpt.files.wordpress.com/2013/10/ios7_4_thumb2.png" width="627" height="487"></a></p>
<p>The new update also adds new color tint support to help you easily branding your app’s design. By easily setting the new TintColor property of the application delegate, the buttons, icons, and other tint-aware visual indicators will reflect the specified tint color. This applies to the new date time editor in the form builder as well.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/10/ios7_1b2.png"><img title="Crosslight applies iOS 7 design principles" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Crosslight applies iOS 7 design principles" src="http://intersoftpt.files.wordpress.com/2013/10/ios7_1b_thumb2.png" width="627" height="620"></a></p>
<p>The sample code below shows how easy it is to take advantage the tint color in your iOS apps.</p>
<p></p><pre class="crayon-plain-tag">[Register("AppDelegate")]
public partial class AppDelegate : IntersoftCore.UIApplicationDelegate
{
	protected override UIViewController WrapRootViewController(UIViewController contentViewController)
	{
		if (contentViewController is UISplitViewController || contentViewController is UITabBarController)
			return contentViewController;

		return new UINavigationController(contentViewController);
	}

        public override UIColor TintColor
        {
            get
            {
                return UIColor.Red;
            }
        }
}</pre><p></p>
<p>Furthermore, a new useful feature is added to allow automatic hiding of the keyboard as users drag the screen – similar to the behavior in the iOS 7’s revamped calendar app. You can easily enable this feature by setting the <em>HideKeyboardOnScroll</em> property.</p>
<h1>Both iOS 6 and iOS 7. Supported in a Single Assembly.</h1>
<p>Crosslight sets a rock-solid foundation for cross-platform native mobile development which enables you to write user interaction logic elegantly in the ViewModel. And now, with the iOS 7 officially supported, you can easily upgrade your Crosslight-powered iOS apps to take advantage of iOS 7 features in just a simple few steps such as assembly update and rebuild – without any changes to your application codebase. And that’s a priceless benefit.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/10/ios7_22.png"><img title="iOS 6 &amp; iOS 7 support" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="iOS 6 &amp; iOS 7 support" src="http://intersoftpt.files.wordpress.com/2013/10/ios7_2_thumb2.png" width="627" height="555"></a></p>
<p>It’s important to note that the new iOS 7 support is added to Crosslight without affecting the features and user interface design that target iOS 6. In the case you want to selectively enable the iOS 7 features, you can do it in the view controller by conditionally customizing the form builder attributes at runtime. See the example code below.</p>
<p></p><pre class="crayon-plain-tag">public partial class ItemEditViewController : UIFormViewController&lt;ItemEditorViewModel&gt;
{
        protected override void InitializeView()
        {
            base.InitializeView();

            // customize form metadata
            var thumbnailImage = this.Form.GetProperty("ThumbnailImage");
            var imageAttribute = thumbnailImage.GetAttribute&lt;ImageAttribute&gt;();

            if (this.IsOS7())
            {
                imageAttribute.UseCircleMask = true;
            }
        }
}</pre><p></p>
<p>To learn more about Crosslight, its key features and advantages, please visit the <a href="http://www.intersoftpt.com/Crosslight">Crosslight home page</a>.</p>
<p>In addition to iOS 7 support, the latest Crosslight update also includes enhancements and stability improvements to the Android and Windows platforms. The navigation transition for the Windows Phone 8 and Windows 8 have been much improved to resemble the default platform’s experiences. For more details, please refer to <a href="http://www.intersoftpt.com/Support/Crosslight/VersionHistory/">Crosslight Version History</a>.</p>
<p>Along with the announcement, we’ve also updated the Mobile Studio installer for both Mac and Windows. You can sign-in to <a href="http://www.intersoftpt.com/Account">your account</a> to download the updated installer, or request a trial <a href="http://www.intersoftpt.com/TrialRequest">here</a>. Feel free to ask any questions or drop your feedback in the comments box below.</p>
<p>Best,<br />Jimmy</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2013/10/crosslight-adds-full-ios-7-support-and-new-ui-features/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building Inventory Tracker Apps with Crosslight</title>
		<link>http://blog.intersoftsolutions.com/2013/09/building-inventory-tracker-apps-with-crosslight/</link>
		<comments>http://blog.intersoftsolutions.com/2013/09/building-inventory-tracker-apps-with-crosslight/#comments</comments>
		<pubDate>Fri, 13 Sep 2013 04:26:16 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2013 R1]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Inventory Tracker]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=3444</guid>
		<description><![CDATA[The Inventory Tracker sample shipped with Intersoft Mobile Studio is a great reference sample that simulates the real-world condition of how a basic, yet still providing a great user experience app should be. The Inventory Tracker is designed for workers that in a warehouse who [...]]]></description>
				<content:encoded><![CDATA[<img width="578" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/supports-multiple-platforms_thumb1-604x282.png" class="attachment-post-thumbnail wp-post-image" alt="Supports Multiple Platforms" style="float:right; margin:0 0 10px 10px;" /><p>The Inventory Tracker sample shipped with Intersoft Mobile Studio is a great reference sample that simulates the real-world condition of how a basic, yet still providing a great user experience app should be. The Inventory Tracker is designed for workers that in a warehouse who want to track the items they have in store. The sample provides intuitive CRUD operation that extends beyond common applications with CRUD functionality. Some details are meticulously considered and thoughtfully designed to provide the user with a great form input experience, when usually form inputs have an impression of being a boring chore.</p>
<p>This blog post aims to elaborate the details that made this reference sample app different from other app with form inputs in the market, while exposing the features of form builder built into Crosslight framework. By just defining one form metadata, you can rest assured that the forms you create in one platform will easily work in another and provide a great and consistent user experience.</p>
<h1>Supports Multiple Platforms</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/supports-multiple-platforms.png"><img title="Supports Multiple Platforms" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Supports Multiple Platforms" src="http://intersoftpt.files.wordpress.com/2013/09/supports-multiple-platforms_thumb.png" width="625" height="282"></a></p>
<p>The Inventory Tracker sample runs on a shared application logic, and runs great on iOS, Android, WIndows Phone and WinRT, while conforming to each platform UI guidelines. The sample does not enforce the same design throughout different platforms, this is because different platforms have different design guidelines and if you try to imitate one platform’s experience with another, this would greatly crimp the user experience.</p>
<h1>Automatic Rotation Handling</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/automatic-rotation-handling.png"><img title="Automatic Rotation Handling" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Automatic Rotation Handling" src="http://intersoftpt.files.wordpress.com/2013/09/automatic-rotation-handling_thumb.png" width="590" height="294"></a></p>
<p>The Inventory Tracker responds fluidly to orientation changes, while keeping the bindings intact. Take Android for example, by standard measures, you would have to eventually store the values entered by the user back and forth yourself every time the Activity is recreated after rotation. Handling this scenario will definitely take a lot of your precious development time. Crosslight has taken care of this from the back-end, so you can rest assure that your data integrity is maintained even after countless orientation changes and the bindings will remain intact.</p>
<h1>Master-Detail Navigation</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/master-detail-navigation.png"><img title="Master-Detail Navigation" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Master-Detail Navigation" src="http://intersoftpt.files.wordpress.com/2013/09/master-detail-navigation_thumb.png" width="624" height="309"></a></p>
<p>The user experience when using a tablet must differ, as you have more screen estate to utilize. In a tablet, you would probably want to split the screen into two parts, a smaller left portion for the items list and the rest of the screen for the detail view. The Inventory Tracker executes this scenario beautifully by adapting itself to tablet devices, using a single codebase. Try to deploy the sample on a tablet device or emulator and see for yourself. More importantly, Crosslight ships with this template by default, so you can easily create such experience with greater ease.</p>
<h1>Powerful Data Bindings</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/powerful-data-bindings.png"><img title="Powerful Data Bindings" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Powerful Data Bindings" src="http://intersoftpt.files.wordpress.com/2013/09/powerful-data-bindings_thumb.png" width="625" height="370"></a></p>
<p>By default, when you are either in add new item screen or editing an item screen, the bindings are set two-way by default. This allows hassle-free editing of items, and the changes made truly reflects the underlying model of the item. The add item command and the save item command are also bound to the button using the robust data binding feature introduced by the form builder of the Crosslight framework. </p>
<h1></h1>
<h1>Versatile Visibility Bindings</h1>
<p>When adding new items using the form metadata, you can hide a specific section using the visibility binding attribute. The item form metadata has a specific SoldSection that can be hidden during addition of new item, since it would be counter-intuitive if you add a new item then immediately mark that item as sold.</p>
<p>In the editing item screen, when the IsSold switch is turned on, the Sold Date property immediately responds by making the sold date editor to visible, on the other hand, when the IsSold switch is turned off, the sold date editor is hidden from the view. This is possible because of the solid MVVM binding framework introduced in Crosslight.</p>
<p></p><pre class="crayon-plain-tag">public class SoldSection
{
	[Editor(EditorType.Switch)]
	[Display(Caption = "Is Sold")]
	public static bool IsSold;

	[Display(Caption = "Sold Date")]
	[Editor(EditorType.Date)]
	[VisibilityBinding(Path = "IsSold")]
	[Binding(StringFormat = "{0:d}")]
	public static DateTime SoldDate;
}</pre><p></p>
<h1>Batch Operations</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/batch-operations.png"><img title="Batch Operations" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Batch Operations" src="http://intersoftpt.files.wordpress.com/2013/09/batch-operations_thumb.png" width="625" height="403"></a></p>
<p>You can execute batch operations on multiple items at once, for example, deleting multiple items at once, or marking them as sold. When marked as sold, the UI immediately responds by giving the label a strikethrough effect to provide a solid user experience. Batch operations allows for greater time saving when executing redundant operations for a batch of items. Apps developed using Crosslight will save a lot of time, not only for you, but also for the users of your app. </p>
<h1>Data Presentation Variations</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/data-presentations-variations.png"><img title="Data Presentations Variations" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Data Presentations Variations" src="http://intersoftpt.files.wordpress.com/2013/09/data-presentations-variations_thumb.png" width="625" height="335"></a></p>
<p>We have shipped two different variations for the iPad version. The first variation of Inventory Tracker sample presents the list of items in a master-detail fashion, whereas the other one showcases the items in a grid-view like structure. These two samples follows the Apple HIG (Human Interface Guidelines) for iPad, therefore giving users a better experience when using the app. Editing screen is also shown differently, one in a detail view, whereas the other one in a popover controller. </p>
<h1>Efficient Memory Management</h1>
<p>The list view introduced in Inventory Tracker sample highlights one of the most important feature that a listing app should have: efficient memory management. This feature is efficiently achieved through smart cell reuse, all done in background. The table cell gets reused when it is out of the view, so you don’t have to worry of having a large amount of footprint when your item list gets too large. All you have to do is provide the items source in the view model and let Crosslight do the rest. Did I forgot to mention that you can freely customize the item template yourself?</p>
<h1>Built-in Search</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/built-in-search.png"><img title="Built-in Search" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Built-in Search" src="http://intersoftpt.files.wordpress.com/2013/09/built-in-search_thumb.png" width="625" height="363"></a></p>
<p>If you have hundreds and thousands of items in the list, how can you filter items accordingly? Well, the Inventory Tracker for Android and iOS platforms are shipped with a powerful built-in search feature that allows you to filter items in a fast, efficient manner. On iOS, items are filtered along as you type, so you can quickly choose an item when it comes to view. On Android, the items will be shown at the exact same time after you have hit the search button on your keyboard.</p>
<h1>Powerful Image Picker Editor</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/powerful-image-picker-editor.png"><img title="Powerful Image Picker Editor" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Powerful Image Picker Editor" src="http://intersoftpt.files.wordpress.com/2013/09/powerful-image-picker-editor_thumb.png" width="625" height="419"></a></p>
<p>Inventory Tracker ships with a powerful image picker editor that allows you to take pictures from the device camera, with added support for cropping and scaling, native to the platform level. More importantly, this is all done just by defining the form metadata using the form builder. You can also add your own custom logic after the you have retrieved the image from the camera by defining commands from the view model. </p>
<p>The Form Metadata definition:</p>
<p></p><pre class="crayon-plain-tag"><p>
[ImagePicker(ImageResultMode = ImageResultMode.Both, ActivateCommand = "ActivateImagePickerCommand", PickerResultCommand = "FinishImagePickerCommand")]
            public static byte[] ThumbnailImage;
</p></pre><p></p>
<p>You can intercept the commands in the view model:</p>
<p></p><pre class="crayon-plain-tag">private void ExecuteActivateImagePicker(object parameter)
        {
            ImagePickerActivateParameter activateParameter = parameter as ImagePickerActivateParameter;
            if (activateParameter != null)
            {
                activateParameter.CustomCommands = new Dictionary();
                activateParameter.CustomCommands.Add("View Larger", this.ViewLargeImageCommand);
            }
        }

        private void ExecuteFinishImagePickerCommand(object parameter)
        {
            ImagePickerResultParameter resultParameter = parameter as ImagePickerResultParameter;

            if (resultParameter != null &amp;&amp; resultParameter.Result != null)
                this.Item.LargeImage = resultParameter.Result.ImageData;
        }</pre><p></p>
<h1>Intelligent Layout Awareness</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/intelligent-layout-awareness.png"><img title="Intelligent Layout Awareness" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Intelligent Layout Awareness" src="http://intersoftpt.files.wordpress.com/2013/09/intelligent-layout-awareness_thumb.png" width="625" height="238"></a></p>
<p>Apps built on the WinRT platform introduces many visual states that many apps might forget to cover: landscape, filled, snapped and portrait. In the WinRT version of the Inventory Tracker sample, we have covered this scenario in depth, while introducing the wrapped LayoutAwarePage that smartly responds to the various screen states introduced in WinRT platform.</p>
<p></p><pre class="crayon-plain-tag"><p>&lt;VisualStateManager.VisualStateGroups&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- Visual states reflect the application's view state --&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VisualStateGroup x:Name="ApplicationViewStates"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VisualState x:Name="FullScreenLandscape"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VisualState x:Name="Filled"/&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- The entire page respects the narrower 100-pixel margin convention for portrait --&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VisualState x:Name="FullScreenPortrait"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Storyboard&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackButton" Storyboard.TargetProperty="Style"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ObjectAnimationUsingKeyFrames&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemGridView" Storyboard.TargetProperty="Padding"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="96,137,10,56"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ObjectAnimationUsingKeyFrames&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Storyboard&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/VisualState&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The back button and title have different styles when snapped, and the list representation is substituted<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for the grid displayed in all other view states<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;VisualState x:Name="Snapped"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Storyboard&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackButton" Storyboard.TargetProperty="Style"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ObjectAnimationUsingKeyFrames&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="PageTitle" Storyboard.TargetProperty="Style"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ObjectAnimationUsingKeyFrames&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemListView" Storyboard.TargetProperty="Visibility"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ObjectAnimationUsingKeyFrames&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemGridView" Storyboard.TargetProperty="Visibility"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ObjectAnimationUsingKeyFrames&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Storyboard&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/VisualState&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/VisualStateGroup&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/VisualStateManager.VisualStateGroups&gt;</p></pre><p></p>
<h1>Tactical Use of Presenters with Data Validation Support</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/tactical-use-of-presenters-with-data-validation-support.png"><img title="Tactical Use of Presenters with Data Validation Support" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Tactical Use of Presenters with Data Validation Support" src="http://intersoftpt.files.wordpress.com/2013/09/tactical-use-of-presenters-with-data-validation-support_thumb.png" width="625" height="262"></a></p>
<p>The Inventory Tracker sample offers data validation support with targeted use of presenters. For example, when you try to add an item and you have not entered a product name, a message presenter will be shown, notifying the error. Also, a toast presenter will be shown after you have finished editing. This subtle, yet important toast message informs the user that changes have been made and saved successfully. Giving users the right feedback at the right time is one of the key fundamentals of creating a rich experience for the users of your app. More importantly, you can be invoke the toast presenter from the view model, making sure that all your apps behave in the same, consistent manner.</p>
<p></p><pre class="crayon-plain-tag">this.ToastPresenter.Show("Changes saved.");</pre><p></p>
<h1>Wrap-Up</h1>
<p>Now you have just seen the features exposed in the inventory tracker sample. This is great news for you because you can easily obtain the same user experience in your app by utilizing the powerful form builder feature in Crosslight. The form builder feature allows you to build forms in minutes, just by specifying partial class for the model which acts as the metadata and giving the corresponding attributes. You can try all of this exciting features by grabbing a copy of Intersoft Mobile Studio from this link: <a href="http://www.intersoftpt.com/RequestTrial">http://www.intersoftpt.com/RequestTrial</a>. Learn more about Crosslight at: <a href="http://www.intersoftpt.com/Crosslight/">http://www.intersoftpt.com/Crosslight/</a>.</p>
<p>Cheers,</p>
<p>Nicholas Lie</p>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<p></p><pre class="crayon-plain-tag"></pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2013/09/building-inventory-tracker-apps-with-crosslight/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Intersoft Mobile Studio – Cross-Platform Development Reimagined</title>
		<link>http://blog.intersoftsolutions.com/2013/09/intersoft-mobile-studio-cross-platform-development-reimagined/</link>
		<comments>http://blog.intersoftsolutions.com/2013/09/intersoft-mobile-studio-cross-platform-development-reimagined/#comments</comments>
		<pubDate>Wed, 11 Sep 2013 12:40:01 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2013 R1]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=3414</guid>
		<description><![CDATA[We are pleased to announce the release of our next-gen toolset for cross-platform mobile development: Intersoft Mobile Studio. Shipped with powerful features with small footprint, Intersoft Mobile Studio marks the next industry-standard for cross-platform development. Built with the proven MVVM design pattern on its core, [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="239" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/mobilebanner2013r1_thumb1-604x239.jpg" class="attachment-post-thumbnail wp-post-image" alt="MobileBanner2013R1" style="float:right; margin:0 0 10px 10px;" /><p>We are pleased to announce the release of our next-gen toolset for cross-platform mobile development: Intersoft Mobile Studio. Shipped with powerful features with small footprint, Intersoft Mobile Studio marks the next industry-standard for cross-platform development. Built with the proven MVVM design pattern on its core, Mobile Studio will definitely change the way you develop cross-platform mobile apps. Designed with the future in mind, meaning that you can easily support new platforms easily as Crosslight is easily extensible to support even hundreds of platforms; you can rest assured knowing that the apps built on top of Crosslight will be future-proof. Remember, you are not developing cross-platform apps that works on in a ported environment; you will create cross-platform <strong>native</strong> apps that will give your audience a rich and pleasant experience when using your apps.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/mobilebanner2013r1.jpg"><img title="MobileBanner2013R1" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="MobileBanner2013R1" src="http://intersoftpt.files.wordpress.com/2013/09/mobilebanner2013r1_thumb.jpg" width="625" height="239"></a></p>
<p>Crosslight ships with a wealth of resources to help you quickly jump start with cross-platform mobile development. In this blog post, I will provide a quick overview of the available resources and where to start your first mobile development journey. If you haven’t installed Crosslight yet, head to <a href="http://www.intersoftpt.com/RequestTrial">Request Trial</a> page and download the free trial.</p>
<h1>Four Powerful Templates</h1>
<p>Once you have installed Intersoft Mobile Studio, open up VS 2012 and create a new project under Visual C# Templates / Intersoft Solutions / Mobile.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/crosslight1.png"><img title="Creating New Project in VS 2012" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Creating New Project in VS 2012" src="http://intersoftpt.files.wordpress.com/2013/09/crosslight1_thumb.png" width="625" height="432"></a></p>
<p>Click OK, and you will be presented with the Crosslight Project Wizard.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/crosslight2.png"><img title="Intersoft Crosslight Project Wizard" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Intersoft Crosslight Project Wizard" src="http://intersoftpt.files.wordpress.com/2013/09/crosslight2_thumb.png" width="625" height="444"></a></p>
<p>Designed with robustness and flexibility, Intersoft Mobile Studio provides you with four powerful templates that is immediately available for your perusal.</p>
<h2></h2>
<h2>Blank Template</h2>
<p>The Blank template is great to help you jump-start development with Crosslight with minimal configuration. It is designed as such for you to quickly grasp the concept of development and design pattern when developing apps using Crosslight.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/blank.jpg"><img title="Blank Template" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Blank Template" src="http://intersoftpt.files.wordpress.com/2013/09/blank_thumb.jpg" width="625" height="294"></a></p>
<h2>Navigation Template</h2>
<p>Looking for designing a great-looking app with navigation features? The Navigation template is here to help you. The Navigation template provides you with navigation templates that can be adjusted using either split navigation or list navigation, depending on your choice.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/navigation.jpg"><img title="navigation" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="navigation" src="http://intersoftpt.files.wordpress.com/2013/09/navigation_thumb.jpg" width="625" height="565"></a></p>
<h2>Master-Detail Template</h2>
<p>This is a truly time-saving template that allows you create master-detail apps easily and quickly. The template deals with the split master-detail view for tablets and is equipped with grouping feature, so you don’t have to scratch your head for a long time on how to build a pleasant master-detail app.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/master-detail.jpg"><img title="Master-Detail Template" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Master-Detail Template" src="http://intersoftpt.files.wordpress.com/2013/09/master-detail_thumb.jpg" width="625" height="555"></a></p>
<h2>Tabbed Template</h2>
<p>Crosslight supports multi-screen apps in the form of “tabs”, also known as pivot and panorama pages on Windows Phone. Just with a click of a button, you are given apps with tabbed templates that works the consistently that conforms to each platform’s UI guidelines. Did I also mention it is MVVM-enabled as well?</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/tabbed.jpg"><img title="Tabbed Template" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Tabbed Template" src="http://intersoftpt.files.wordpress.com/2013/09/tabbed_thumb.jpg" width="625" height="356"></a></p>
<h1>Crosslight Solution Structure</h1>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/project-structure.png"><img title="project-structure" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="project-structure" src="http://intersoftpt.files.wordpress.com/2013/09/project-structure_thumb.png" width="277" height="568"></a></p>
<p>After you have finished choosing one of the templates, you will get the following solution structure. Just set as one of the projects as your startup project, and watch the magic happens.</p>
<h1>Comprehensive Documentation</h1>
<p>If you ever get stuck when developing apps with Crosslight, Intersoft Mobile Studio ships with 300 pages covering the best practices, walkthroughs and concepts for building highly scalable enterprise mobile apps. The Crosslight documentation covers a wide range of in-depth topics such as fundamentals of Crosslight, understanding MVVM, defining consistent navigation interface, utilizing the built-in presenters for basic user interactions, working with data, building rich data-entry form, and much more. It also covers platform specific topics such as how to define different layouts for iPhone and iPad, using Fragments in Android, understanding navigation patterns in Windows Phone, handling layout changes in WinRT, and much more.</p>
<h1>Robust Samples</h1>
<p>To help you get started, Intersoft Mobile Studio ships with four projects that comprises of hundreds of samples across all supported platforms to help you better understand how to develop apps using Crosslight framework.</p>
<h2>MVVM Samples</h2>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/mvvm.jpg"><img title="MVVM Samples" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="MVVM Samples" src="http://intersoftpt.files.wordpress.com/2013/09/mvvm_thumb.jpg" width="625" height="404"></a></p>
<p>The MVVM Samples is a great place to start as it covers many MVVM features offered in Crosslight, such as demonstrating the basics of MVVM and binding capabilities, for example, binding mode, update source trigger mode, and converter. It also includes several reference samples – such as loan calculator and currency converter – to help you understand how the binding features work together.</p>
<h2>Data Samples</h2>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/data.jpg"><img title="Data Samples" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Data Samples" src="http://intersoftpt.files.wordpress.com/2013/09/data_thumb.jpg" width="625" height="404"></a></p>
<p>This project includes a collection of samples showcasing the data-aware features such as presenting as a simple list, grouped list and searchable list. It also shows how to deal with data management in common business scenarios such as data editing, update and delete, as well as batch updating. In addition, it also demonstrates a number of built-in list styles available in each platform as well as showing the customization of list item template.</p>
<h2>Services Samples</h2>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/services.jpg"><img title="Services Samples" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Services Samples" src="http://intersoftpt.files.wordpress.com/2013/09/services_thumb.jpg" width="625" height="404"></a></p>
<p>This project includes a collection of samples showcasing various prebuilt services available in Crosslight such as navigation services, presenter services, platform services and mobile services. All services are programmable in the shared application layer which allows you to streamline the user interaction logic as well as enable maximum code sharing. Mobile services demonstrate a vast array of services commonly available to mobile platform such as telephony services, location services, camera services, social services, map services and much more.</p>
<h2>Inventory Tracker</h2>
<p><a href="http://intersoftpt.files.wordpress.com/2013/09/inventorytracker.png"><img title="Inventory Tracker" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Inventory Tracker" src="http://intersoftpt.files.wordpress.com/2013/09/inventorytracker_thumb.png" width="625" height="305"></a></p>
<p>Thoughtfully designed and well-defined user interfaces, the Inventory Tracker is a a reference sample that works consistently across platforms and conforms to the de facto UI specifications for each platform. The Inventory Tracker provides a lot of meticulous features that offers a pleasant user experience. Features of the Inventory Tracker will covered in depth on the upcoming post.</p>
<h1>What’s Next?</h1>
<p>This is just the beginning. With iOS 7 just around the corner, we will be going to fully support iOS 7 within a week after it has been released to the public. In the upcoming milestone, we will enhance Crosslight with powerful and robust data access framework with sync support, saving you the hassle of writing hundreds lines of codes just for data syncing purposes. Also, we will shift our sprint tasks to a more fast-paced, dynamic progression; giving you regular updates that will tremendously enhance your development experience with Crosslight.</p>
<p>Cheers,<br />Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2013/09/intersoft-mobile-studio-cross-platform-development-reimagined/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cross Platform Mobile Development with Crosslight – Part 1</title>
		<link>http://blog.intersoftsolutions.com/2013/06/cross-platform-mobile-development-with-crosslight-part-1/</link>
		<comments>http://blog.intersoftsolutions.com/2013/06/cross-platform-mobile-development-with-crosslight-part-1/#comments</comments>
		<pubDate>Wed, 12 Jun 2013 04:18:00 +0000</pubDate>
		<dc:creator><![CDATA[Jimmy Petrus]]></dc:creator>
				<category><![CDATA[2013 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Cross Platform]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[Windows App Store]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=3232</guid>
		<description><![CDATA[As the Crosslight development is maturing and we’re entering the last few sprints of our R1 milestone, I’m pleased to share more details about Crosslight and also providing insights and answers to many questions that have landed to my inbox since the introduction. In my [...]]]></description>
				<content:encoded><![CDATA[<img width="466" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/crosslight-architecture-revision_thumb1-604x350.png" class="attachment-post-thumbnail wp-post-image" alt="Crosslight Architecture" style="float:right; margin:0 0 10px 10px;" /><p>As the Crosslight development is maturing and we’re entering the last few sprints of our R1 milestone, I’m pleased to share more details about Crosslight and also providing insights and answers to many questions that have landed to my inbox since the introduction. In my previous <a href="https://intersoftpt.wordpress.com/2013/03/12/announcing-intersoft-2013-product-roadmap/">blog post</a>, I’ve shared about our 2013 roadmap and the new exciting direction that we’re heading to – particularly in the mobile development space.</p>
<p>We’re very excited with several new product lineups that we’ve got in the labs so far, and I’m sure you can feel the same excitement as well. We’re going to have new stuff in all the three existing platforms (ASP.NET, Silverlight and WPF), plus a range of new mobile platforms. Sneak the previews of the upcoming ASP.NET lineups <a href="http://intersoftpt.wordpress.com/2013/04/24/coming-soon-in-2013-r1-new-features-for-asp-net-lineup-all-new-modern-ui-themes-and-more/">here</a> and <a href="http://intersoftpt.wordpress.com/2013/05/16/new-in-2013-r1-webscheduler-4/">here</a>.</p>
<p>In this first part of my blog series on Crosslight, I’ll be strongly focused on the high level overview of the product – mainly discussing the architectural overview, what it does, and how it works. Alright, enough appetizer, let’s move forward to the main course.</p>
<h1>Native Mobile Development Goes Cross Platform</h1>
<p>Cross platform mobile development has inevitably becomes one of the hottest subject in the programming world today. Our recent survey supports that fact very well with over 83% respondents stating they&#8217;re planning to build mobile apps targeting two or more mobile platforms in the near future. The main question here is, what tools are available today and whether the tools are ready to accomodate the fast-pacing needs – and more importantly, which is the right tool to get the job done?</p>
<p>Before we started the Crosslight project, there were already a number of tools for cross platform mobile development in the market such as PhoneGaps and Titanium. These tools definitely did a great job for HTML and Javascript savvy. But how about developers with particularly Silverlight/WPF skillset? While we all felt left out, it’s going to change very soon. Read on.</p>
<h2>A Deeper Look at Crosslight</h2>
<p>The main objective of Crosslight is to bring MVVM design pattern – a pattern that most Silverlight &amp; WPF developers are familiar with – to the iOS and Android world. Integrated to Xamarin technologies, Crosslight opens up a whole new level of possibilities in the way you build mobile apps. Instead of writing code for each platform in their own language with completely different set of API, Crosslight lets you write application logic once with a common API which can be shared to multiple projects targeting different platforms.</p>
<p>This is made possible thanks to the <em>Crosslight Foundation</em> that provides powerful data binding implementation, high-performance messaging and commanding framework, and thoughtfully engineered application services. On the other end, Crosslight will be available on each different platform to provide the service implementation specific to the platform. Called <em>Crosslight UI Platform</em>, it also includes numerous pre-built user interface components and controllers that are essential to create great mobile business apps with consistent user experiences.</p>
<p>See the following illustration to get deeper insights on Crosslight architecture. It also shows how different technologies are stacked together in a high level perspective.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/07/crosslight-architecture-revision.png"><img title="Crosslight Architecture" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="Crosslight Architecture" src="http://intersoftpt.files.wordpress.com/2013/07/crosslight-architecture-revision_thumb.png" width="722" height="537"></a></p>
<p>As seen in the above architecture diagram, Crosslight builds on the mobile development platforms provided by Xamarin and Microsoft to introduce a host of innovative view components that span across all of the 4 major mobile platforms including iOS, Android, Windows Phone, and Windows App Store.</p>
<p>Future new platforms can be easily supported without major changes to existing code – thanks to the Crosslight Foundation that is built upon portable technology. This obviously gives many benefits as you can avoid getting locked to certain technologies that apply only to a specific platform.</p>
<h2>Code Reusability Accelerated to A New Height</h2>
<p>With each mobile platform designed by different vendor – iOS designed by Apple, Android designed by Google, and Windows Phone designed by Microsoft – each platform exposes completely different API and design pattern. This makes <em>application logic sharing</em> one of the biggest challenges in cross-platform mobile development. To get a grasp on the API and design pattern differences of each platform, take a look at the simple Hello World implementation below.</p>
<p>Hello World in Xamarin.iOS:</p>
<p></p><pre class="crayon-plain-tag">public class MyViewController : UIViewController
{
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        ...

        button.SetTitle("Click me", UIControlState.Normal);

        button.TouchUpInside += (object sender, EventArgs e) =&gt;
            {
                UIAlertView alertView = new UIAlertView();
                alertView.Title = "My MobileApp";
                alertView.Message = "Hello world from my mobile app";
                alertView.AddButton("OK");
                alertView.Show();
            };
    }
}</pre><p></p>
<p>Hello World in Xamarin.Android:</p>
<p></p><pre class="crayon-plain-tag">[Activity(Label = "AndroidApplication1", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        ...

        Button button = FindViewById&lt;button&gt;(Resource.Id.MyButton);

        button.Click += delegate
            {
                AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);

                dlgAlert.SetMessage("Hello world from mobile app");
                dlgAlert.SetTitle("My MobileApp");
                dlgAlert.SetPositiveButton("OK", (o, e) =&gt; { });
                dlgAlert.SetCancelable(true);
                dlgAlert.Create().Show();
            };
    }
}</pre><p></p>
<p>Hello World in Windows Phone:</p>
<p></p><pre class="crayon-plain-tag">public partial class MainPage : PhoneApplicationPage
{
    ...

    private void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        this.MyButton.Click += (object s, RoutedEventArgs e2) =&gt;
            {
                MessageBox.Show("Hello world from mobile app");
            };
    }
}</pre><p></p>
<p>As seen in the above examples, none of the application logic code are shareable which is natural due to the API differences of each platform.</p>
<p>In the examples above, notice that the iOS and Android code was written in C# instead of Obj-C or Java – thanks to the Xamarin platforms that solve the language barriers in cross-platform mobile development. Xamarin provides developers the ability to share (on average) 75% of their C# code between iOS, Android, and Windows, and can reach as high as 90%. Crosslight builds on this by adding a cross-platform MVVM framework, allowing developers to consistently reach nearly 96% code reuse. </p>
<p>The following code samples show how to use Crosslight to build your iOS, Android, and Windows UI, reusing the same ViewModel across each platform:</p>
<p>Crosslight iOS App:</p>
<p></p><pre class="crayon-plain-tag">[ImportBinding(typeof(HelloWorldBindingProvider))]
public class MyViewController : UIViewController&lt;HelloWorldViewModel&gt;
{
}</pre><p></p>
<p>Crosslight Android App:</p>
<p></p><pre class="crayon-plain-tag">[Activity(Label = "AndroidApplication1", MainLauncher = true, Icon = "@drawable/icon")]
[ImportBinding(typeof(HelloWorldBindingProvider))]
public class Activity1 : Activity&lt;HelloWorldViewModel&gt;
{
}</pre><p></p>
<p>Crosslight Windows Phone App:</p>
<p></p><pre class="crayon-plain-tag">[ImportBinding(typeof(HelloWorldBindingProvider))]
[ViewModelType(typeof(HelloWorldViewModel))]
public partial class MainPage : PhoneApplicationPage
{
}</pre><p></p>
<p>It&#8217;s awesomely clean, agree? That’s made possible as the UI logic is moved from the platform-specific views to the core MVVM project. Now the UI logic code looks like the following.</p>
<p></p><pre class="crayon-plain-tag">public class HelloWorldViewModel : ViewModelBase
{
    public HelloWorldViewModel()
    {
        this.HelloCommand = new DelegateCommand(this.ExecuteHelloCommand);
    }

    public DelegateCommand HelloCommand { get; set; }

    private void ExecuteHelloCommand(object parameter)
    {
        this.MessagePresenter.Show("Hello world from Crosslight mobile app", "My App");
    }
}</pre><p></p>
<p>If you’ve built Silverlight or WPF apps with Intersoft ClientUI – which I highly presumed you have – then you should recognize the above code at the first look. It leverages the design pattern similar to ClientUI such as delegate command and view presenter. Later on, you’ll find more APIs that you’re already accustomed to – which allow you to get started quickly with very minimal learning curves.</p>
<p>As always, our goal is to simplify developer’s life and make the jobs done with the right tool. Crosslight was designed to do just that. With app UI logic now sharable, it boosted the overall code reusability to nearly 96%, leaving the small percentage on the app-specific layers such as views and controllers.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/06/code-reusability.png"><img title="Code Reusability" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Code Reusability" src="http://intersoftpt.files.wordpress.com/2013/06/code-reusability_thumb.png" width="642" height="350"></a></p>
<p>The above illustration visualizes the typical code reusability in cross-platform mobile development and shows how Crosslight supercharge it to a whole new, never-before-possible level.</p>
<h2>True Native Mobile Apps</h2>
<p>In the past few weeks, I received numerous emails asking if Crosslight uses HTML as its main presentation layer but wrapped as native app. That&#8217;s what the other solutions such as PhoneGaps are doing. In contrast, Crosslight is a cross-platform solution that completely uses native platform API. This doesn’t only give you the best user interface that conforms to the platform guidelines, it also delivers great performance and extremely smooth UX that cannot be simulated with HTML. See the illustration below to get a proper understanding on the platform-specific user experiences enabled in Crosslight.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/06/crosslightui_1.png"><img title="Crosslight embraces the best of both worlds: maximum code reusability and amazing user experiences." style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Crosslight embraces the best of both worlds: maximum code reusability and amazing user experiences." src="http://intersoftpt.files.wordpress.com/2013/06/crosslightui_1_thumb.png" width="702" height="887"></a></p>
<p>Obviously, it’ll be always the best option to build apps in native user experiences as you can leverage many of the pre-built platform API, including the high-performance UI virtualization, multi-touch gestures, navigation, animations and much more. The only question is whether it’s possible to do so with the skills you already accustomed to – well, now it is.</p>
<h2>Wrapping Up</h2>
<p>At this point, I hope you’ve got it clear that Crosslight targets pure native platforms. No HTML or Javascript is required. You use C# to write code and layer your apps in 3-tier architecture as you may have done in Silverlight or WPF applications. Because Xamarin.iOS and Xamarin.Android apps are 100% native, the final output are real native binaries that conform to the platform byte code and processor instructions. They are not virtualized, cross-compiled, or interpreted – in fact they feature the same level of performance and resources management as in the apps produced by the original platform’s compiler.</p>
<p>In this blog post, I’ve only scratched the surface of the Crosslight architecture. As an official Xamarin Premier Partner, we are working closely with Xamarin in our vision to create the most comprehensive sets of cross-platform frameworks and reusable view components that help developers build cross-platform mobile apps in dramatically less time with less effort. As the results, you will be able to rapidly create amazing mobile business apps with native user experiences while maximizing code sharing.</p>
<p>In the next blog series, I will share more details such as more code-level tutorials and basic API usage, UI &amp; UX design best practices and how they conform to each platform guidelines, as well as many great features like universal data management, streamlined navigation and various mobile services. Anyway, I hope this post gives you a comprehensive overview of Crosslight and how we leveraged different pieces of latest technologies to deliver the most elegant solution for cross-platform native mobile development.</p>
<h2>Sign Up for Beta</h2>
<p>Last but not least, we’re opening a private beta for selected candidates who are willing to contribute significant feedback and help us testing the product features in details. If you believe that you’re the right candidate we’re looking for, please click <a href="mailto:beta@intersoftpt.com?subject=Interested in Crosslight beta testing">here</a> to sign up for a beta. Thanks for reading and stay tuned for the next posts!</p>
<p>All the best,<br />Jimmy</p>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2013/06/cross-platform-mobile-development-with-crosslight-part-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
