<?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; Getting Started Guide</title>
	<atom:link href="http://blog.intersoftsolutions.com/category/getting-started-guide/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>Crosslight Essential Walkthroughs</title>
		<link>http://blog.intersoftsolutions.com/2016/05/crosslight-essential-walkthroughs/</link>
		<comments>http://blog.intersoftsolutions.com/2016/05/crosslight-essential-walkthroughs/#comments</comments>
		<pubDate>Thu, 12 May 2016 02:06:50 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Getting Started Guide]]></category>
		<category><![CDATA[kb-how-to-article]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[MVVM]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=8049</guid>
		<description><![CDATA[Based on your valuable feedbacks, we&#8217;ve compiled a list of Crosslight essential walkthroughs that will help you get started with Crosslight in no time. These topics cover a wide range of development scenarios, such as creating your first Crosslight app from a Xamarin template, performing [...]]]></description>
				<content:encoded><![CDATA[<img width="499" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/getting-started-499x270.png" class="attachment-post-thumbnail wp-post-image" alt="getting-started" style="float:right; margin:0 0 10px 10px;" /><p>Based on your valuable feedbacks, we&#8217;ve compiled a list of Crosslight essential walkthroughs that will help you get started with Crosslight in no time. These topics cover a wide range of development scenarios, such as creating your first Crosslight app from a Xamarin template, performing navigation from the ViewModel, executing commands, and much more. This blog post aims to give you a rough overview on each walkthrough has to offer.</p>
<p>You can find these walkthroughs under <a href="http://developer.intersoftsolutions.com/display/crosslight/Getting+Started+with+Crosslight" target="_blank">Getting Started with Crosslight</a> section in the Developer Center. Without further ado, let&#8217;s get started.</p>
<p><img class="alignnone size-full wp-image-8066" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/getting-started.png" alt="getting-started.png" width="300" height="1136" /></p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Introduction+to+Crosslight+NuGet+Packages" target="_blank">Introduction to Crosslight NuGet Packages</a></h1>
<p>Starting from Crosslight 5, all Crosslight dependencies are now streamlined to NuGet package manager for a more streamlined dependency management and allows for more timely Crosslight updates and hotfixes.</p>
<p><img class="alignnone size-full wp-image-8089" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/introduction-to-crosslight-nuget-packages.png" alt="introduction-to-crosslight-nuget-packages.png" width="2000" height="1260" /></p>
<p>Now you no longer have to deal with tedious references when working with Crosslight. This guide provides a comprehensive overview on how to work with the NuGet packages on both Xamarin Studio Mac as well as Visual Studio Windows, such as installing, updating and restoring NuGet packages.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Working+with+Crosslight+NuGet+Packages" target="_blank">Working with Crosslight NuGet Packages</a></h1>
<p>Similar to the previous guide, this walkthrough provides a more hands-on approach to working with NuGet packages with step-by-step guidances and rich visual walkthrough.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Creating+Your+First+Crosslight+App" target="_blank">Creating Your First Crosslight App</a></h1>
<p>This guide will walk you through the process of converting a simple Xamarin template that uses shared PCL project and transform it into a working Crosslight project.</p>
<p><img class="alignnone size-full wp-image-8099" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/creating-your-first-crosslight-app.png" alt="creating-your-first-crosslight-app.png" width="1255" height="1080" /></p>
<p>It is highly recommended to follow this walkthrough if you&#8217;re coming from a Xamarin background. After you&#8217;ve finished this project, you&#8217;ll get a rough idea of how Crosslight works and its excellent design pattern.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Creating+New+Project+with+Crosslight+Project+Wizard" target="_blank">Creating New Project with Crosslight Project Wizard</a></h1>
<p>If you&#8217;re using Visual Studio for mobile development, then this guide will help you create your first Crosslight app in no time with the Crosslight Project Wizard.</p>
<p><img class="alignnone size-full wp-image-8111" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/Screen-Shot-2016-02-26-at-8.55.54-AM.png" alt="Screen Shot 2016-02-26 at 8.55.54 AM.png" width="1280" height="922" /></p>
<p>With Crosslight Project Wizard, you can easily create various quick-start projects easily such as the Blank template, Master-Detail template, Navigation Drawer template, Business template, Localizable Business template as well as the Multi-Page template.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Creating+a+Simple+Tip+Calculator" target="_blank">Creating a Simple Tip Calculator</a></h1>
<p>Once you&#8217;ve finished creating a starter Crosslight app, it&#8217;s best to start working with simplest data binding capabilities available in Crosslight, and there&#8217;s no better app to learn it from other than building a simple tip calculator.</p>
<p><img class="alignnone size-full wp-image-8117" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/simple-tip-calculator.png" alt="simple-tip-calculator.png" width="1260" height="1080" /></p>
<p>This simple app will help you understanding how to perform a centralized data binding in the PCL project, and process your app&#8217;s business processes from the ViewModel, making it more centralized than ever.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Performing+Navigation" target="_blank">Performing Navigation</a></h1>
<p>In this guide, you&#8217;ll learn how to perform various screen navigation by utilizing Crosslight&#8217;s built-in navigation service, which will be invoked directly from the ViewModel. This is one of the essential knowledge needed to build a mobile app with Crosslight.</p>
<p><img class="alignnone size-full wp-image-8129" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/Screen-Shot-2016-02-11-at-11.28.13-AM.png" alt="Screen Shot 2016-02-11 at 11.28.13 AM.png" width="1518" height="1224" /></p>
<p>You&#8217;ll also learn how to perform various types of navigation, such as push navigation, modal navigation, push navigation and modal navigation with parameters, modal navigation with callback, and navigating to a new ViewModel with Identifier.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Executing+Commands" target="_blank">Executing Commands</a></h1>
<p>This walkthrough will help you learn how to execute commands with parameters on buttons and bar items.</p>
<p class="p1"><img class="alignnone size-full wp-image-8135" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/result.png" alt="result.png" width="984" height="808" /></p>
<p class="p1"><span class="s1">With Crosslight&#8217;s solid MVVM data binding, you&#8217;ll learn how to update a button&#8217;s state with a flick of a switch, which will update the invalidate the CanExecute state of all commands.</span></p>
<h1 class="p1"><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Getting+Started+with+MVVM+Data+Binding" target="_blank">Getting Started with MVVM Data Binding</a></h1>
<p class="p1"><span class="s1">In this tutorial, you&#8217;re going to learn how to perform simple data binding, in MVVM-fashion with Crosslight, such as:</span></p>
<ul class="ul1">
<li class="li1"><span class="s1">Binding text to labels and text boxes</span></li>
<li class="li1"><span class="s1">Binding numeric values to slider, text boxes and stepper</span></li>
<li class="li1"><span class="s1">Binding boolean values to switch</span></li>
<li class="li1"><span class="s1">Binding DateTime values to DateTime picker</span></li>
<li class="li1"><span class="s1">Binding image to image view</span></li>
<li class="li1"><span class="s1">Binding simple list of data to a list</span></li>
</ul>
<p><img class="alignnone size-full wp-image-8139" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/result-2.png" alt="result-2.png" width="949" height="808" /></p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Showing+Presenters" target="_blank">Showing Presenters</a></h1>
<p class="p1"><span class="s1">In this tutorial, you&#8217;re going to learn how to use Crosslight Presenters that are built-in to the Crosslight ViewModels, which consists of Action Presenter, Message Presenter, Toast Presenter, Dialog Presenter and Action Toast Presenter. </span></p>
<p class="p1"><img class="alignnone size-full wp-image-8143" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/result-3.png" alt="result-3.png" width="981" height="808" /></p>
<p class="p1">These presenters will surely help you display actions and messages to your users without any further hassles.</p>
<h1 class="p1"><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Accessing+Crosslight+Mobile+Services" target="_blank">Accessing Crosslight Mobile Services</a></h1>
<p>Crosslight ViewModels comes with built-in mobile services that are very handy to achieve various native functions of the devices.</p>
<p><img class="alignnone size-full wp-image-8145" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/result-4.png" alt="result-4.png" width="1423" height="1136" /></p>
<p>In this walkthrough, you&#8217;ll learn how to use the following mobile services:</p>
<ul>
<li>Browser Service</li>
<li>Camera Service</li>
<li>Contact Service</li>
<li>Local Notification Service</li>
<li>Location Service</li>
<li>Mail Service</li>
<li>Map Service</li>
<li>Media Library Service</li>
<li>Media Service</li>
<li>Messaging Service</li>
<li>Reachability Service</li>
<li>Social Service</li>
<li>Telephony Service</li>
</ul>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Getting+Started+with+Crosslight+Form+Builder" target="_blank">Getting Started with Crosslight Form Builder</a></h1>
<p>When building enterprise mobile apps, you&#8217;ll inevitably come across mobile forms. Although it may look simple, building forms that works and render beautifully across platforms often requires tremendous efforts, especially ones that also includes client-side validation support.</p>
<p><img class="alignnone size-full wp-image-8159" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/FormBuilder.001.jpeg" alt="FormBuilder.001.jpeg" width="1024" height="768" /></p>
<p>Crosslight Form Builder makes this process very easily and seamless, thanks to the intuitive Form Metadata that allows you to build forms in minutes, not days.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Getting+Started+with+Crosslight+Charting" target="_blank">Getting Started with Crosslight Charting</a></h1>
<p>Starting with Crosslght 4, Crosslight comes with a handy UI component that is very much sought after by mobile developers, which is mobile charting capabilities.</p>
<p><img class="alignnone size-full wp-image-8167" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/crosslight-charting.png" alt="crosslight-charting.png" width="1147" height="966" /></p>
<p>With Crosslight Charting, you can now easily build cross-platform mobile charts quickly and easily, with full MVVM capabilities. Just bind your data right within the ViewModela, and voila, your mobile chart is done.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Create+CRM+App+with+Crosslight+AppFramework+and+WebApi" target="_blank">Create CRM App with Crosslight AppFramework and WebApi</a></h1>
<p>Now that you&#8217;ve managed to build basic mobile apps, now it&#8217;s time to take it up a notch. In this tutorial, you&#8217;ll learn how to create a simple mobile CRM app that works with Microsoft WebAPI.</p>
<p><img class="alignnone size-full wp-image-8174" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/simple-crm.png" alt="simple-crm.png" width="1063" height="816" /></p>
<p>Thanks to Crosslight&#8217;s built-in tooling support, the process of creating shared models between client and server is made seamless. Simply save your EDMX file from Visual Studio and let the code generator works its wonders.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Create+a+To-Do+App+with+SQLite+Storage" target="_blank">Create a To-Do App with SQLite Storage</a></h1>
<p>Now that you&#8217;ve managed to create a simple CRM app, in this tutorial you&#8217;ll learn how to create a simple, working to-do app that you can use on a daily basis.</p>
<p><img class="alignnone size-full wp-image-8179" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/result-5.png" alt="result-5.png" width="948" height="808" /></p>
<p>This To-Do app will allow you add and complete tasks and saves right into SQLite mobile database. With Crosslight, you&#8217;ll learn how to achieve this scenario effortlessly.</p>
<h1><a href="http://developer.intersoftsolutions.com/display/crosslight/Walkthrough%3A+Create+a+To-Do+App+with+Data+Synchronization" target="_blank">Create a To-Do app with Data Synchronization</a></h1>
<p>Next, you&#8217;ll upgrade this project to include cross-platform data synchronization with WebAPI. With this tutorial, you&#8217;ll learn how to create a cross-platform to-do app that syncs data to each other.</p>
<p><img class="alignnone size-full wp-image-8186" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/05/result-6.png" alt="result-6.png" width="960" height="808" /></p>
<p>This app also comes with pull-to-refresh support to directly refresh and syncs the data.</p>
<h1>Wrapping Up</h1>
<p>Not stopping here, these list of walkthroughs will continue to grow and hopefully will become a very valuable resources for Crosslight developers who are just starting with the framework.</p>
<p>Till next post,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2016/05/crosslight-essential-walkthroughs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with Unified WebUI Application</title>
		<link>http://blog.intersoftsolutions.com/2016/03/getting-started-with-unified-webui-application/</link>
		<comments>http://blog.intersoftsolutions.com/2016/03/getting-started-with-unified-webui-application/#comments</comments>
		<pubDate>Tue, 29 Mar 2016 06:19:15 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2016 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Getting Started Guide]]></category>
		<category><![CDATA[WebUI]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=7519</guid>
		<description><![CDATA[Starting from Premier Studio 2016, WebUI took a completely new look and feel with the new Unified Theming made for ASP.NET. As the name implies, Unified Theming allows you to impose a unified design language that applies to the entire suite of WebUI components with a modern [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/getting-started1-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="getting-started" style="float:right; margin:0 0 10px 10px;" /><p><img class="alignnone size-full wp-image-7540" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/getting-started1.png" alt="getting-started.png" width="2000" height="816" /></p>
<p>Starting from Premier Studio 2016, WebUI took a completely new look and feel with the new Unified Theming made for ASP.NET. As the name implies, Unified Theming allows you to impose a unified design language that applies to the entire suite of WebUI components with a modern CSS theming language that combines mixins and overridable variables.</p>
<p>This blog post is simply made to show you how to create a new Unified Theming project using the new project template that comes with Premier Studio 2016 or higher.</p>
<h1>What You Need</h1>
<p>To follow this tutorial, simply install Premier Studio 2016 or newer. You&#8217;ll also need to have Visual Studio 2012 or higher installed on Windows 7 or newer. If you haven&#8217;t installed it yet, please download it from our <a href="http://www.intersoftsolutions.com/RequestTrial" target="_blank">site</a>. Or, simply login to your <a href="http://www.intersoftsolutions.com/Account" target="_blank">account</a>.</p>
<h1>Let&#8217;s Do This</h1>
<p>Simply open up your Visual Studio instance, then hit <strong>New</strong>, <strong>Project</strong>. From the dialog that appears, choose <strong>Visual C#</strong>, <strong>Intersoft Solutions</strong>, <strong>ASP.NET</strong>, then choose <strong>Intersoft Unified Empty Web Application</strong>.</p>
<p><img class="alignnone size-full wp-image-7550" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/dialog.png" alt="dialog.png" width="1213" height="858" /></p>
<p>Enter the necessary details such as the project name, location and solution name. Hit OK when you&#8217;re done. To run this project, simply right-click on the <strong>Default.aspx</strong> file, then choose <strong>View in Browser</strong>.</p>
<p><img class="alignnone size-full wp-image-7557" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/view-in-browser1.png" alt="view-in-browser" width="1021" height="483" /></p>
<p>You&#8217;ll get the following screen.</p>
<p><img class="alignnone size-full wp-image-7559" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/result.png" alt="result.png" width="1784" height="1136" /></p>
<p>This new Unified Theming template is intuitively design so as to provide basic ideas on how to get started quickly with a new WebUI Unified Theming application, complete with working data bindings for WebCombo, WebInput, WebGrid, and more. At the bottom part of this page we&#8217;ve also provided several business-inspiring samples to help inspire your next big web applications.</p>
<p><img class="alignnone size-full wp-image-7582" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/business-inspiring.png" alt="business-inspiring.png" width="1976" height="1126" /></p>
<h1>Wrapping Up</h1>
<p>To learn more what you need to do to use the new Unified Theming in your existing applications, check out the <a href="http://developer.intersoftsolutions.com/display/WebUI/Unified+Theming" target="_blank">documentation</a>. Or, if you prefer to try migrating an existing WebUI sample, for example the WebGrid&#8217;s Enterprise sample, I highly recommend you to check out my previous <a href="http://blog.intersoftsolutions.com/2016/03/migrating-to-webui-unified-theming/" target="_blank">blog post</a>, where I&#8217;ve covered a step-by-step walkthrough on how to migrate the sample to use Unified Theming.</p>
<p>To get a better grasp on the Unified Theming feature and what customizable areas available for each control, feel free to check out these great documentations:</p>
<ul>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebGrid+Modern+Theme+Style+Reference" target="_blank">WebGrid Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebCombo+Modern+Theme+Style+Reference" target="_blank">WebCombo Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebInput+Modern+Theme+Style+Reference" target="_blank">WebInput Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebDesktop+Modern+Theme+Style+Reference" target="_blank">WebDesktop Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebScheduler+Modern+Theme+Style+Reference" target="_blank">WebScheduler Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebEssentials+Modern+Theme+Style+Reference" target="_blank">WebEssentials Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebTextEditor+Modern+Theme+Style+Reference" target="_blank">WebTextEditor Modern Theme Style Reference</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/WebUI/WebTreeView+Modern+Theme+Style+Reference" target="_blank">WebTreeView Modern Theme Style Reference</a></li>
</ul>
<p>We can&#8217;t wait to see what you&#8217;ve built with this new Unified Theming feature. Let us know in the comments section below!</p>
<p>Till next post,<br />
Nicholas Lie</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2016/03/getting-started-with-unified-webui-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performing Data Binding to Native Views with Crosslight</title>
		<link>http://blog.intersoftsolutions.com/2016/03/performing-data-binding-to-native-views-with-crosslight/</link>
		<comments>http://blog.intersoftsolutions.com/2016/03/performing-data-binding-to-native-views-with-crosslight/#comments</comments>
		<pubDate>Tue, 22 Mar 2016 09:58:28 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Getting Started Guide]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Materials]]></category>
		<category><![CDATA[form builder]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Xamarin Forms]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=7327</guid>
		<description><![CDATA[In my last post, I wrote an in-depth, step-by-step tutorial on how to create you can migrate a Xamarin.Forms sample and turn it into a Crosslight solution. The process might seem intricate at first, but once you understood the basics of Crosslight and its design pattern, you&#8217;ll be able to [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/login-view-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="login-view" style="float:right; margin:0 0 10px 10px;" /><p>In my <a href="http://blog.intersoftsolutions.com/2016/03/migrating-from-xamarin-forms-to-crosslight-app" target="_blank">last post</a>, I wrote an in-depth, step-by-step tutorial on how to create you can migrate a Xamarin.Forms sample and turn it into a Crosslight solution. The process might seem intricate at first, but once you understood the basics of Crosslight and its design pattern, you&#8217;ll be able to do things very quickly. That&#8217;s made possible as Crosslight enforces clear separation-of-concerns and strong and extensible design patterns.</p>
<p>In this post, I&#8217;m going to modify the login screen from the finished sample in the previous blog post to use the native UI views instead of Crosslight Form Builder. Hopefully at the end of tutorial you&#8217;ll have rough ideas how to bind data to native UI views with Crosslight, and gain insights how to take advantage of many different Crosslight features to achieve a goal in the most efficient way.</p>
<p><img class="alignnone size-full wp-image-7350" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/login-view.png" alt="login-view.png" width="2000" height="867" /></p>
<h1>Starting Off</h1>
<p>To follow this tutorial perfectly, you&#8217;ll need clone <a href="http://git.intersoftpt.com/projects/CT/repos/crosslightxamarinformsbuilder/browse" target="_blank">this repository</a>. This is the finished sample from the previous blog post. To run this sample, you&#8217;ll need to restore the necessary NuGet packages. After you&#8217;ve managed to clone and run this sample, you&#8217;re ready to begin. If you have any trouble in restoring the NuGet packages, consult <a href="http://developer.intersoftsolutions.com/display/crosslight/Introduction+to+Crosslight+NuGet+Packages" target="_blank">the documentation</a>.</p>
<h1>Modifying the Android Login View</h1>
<p>First, open up the <strong>LoginFragment.cs</strong> located inside the <strong>XamarinFormsSample.Android/Fragments</strong> folder. Replace the contents with this code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Fragments</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The main Fragment contained inside LoginActivity.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     This class is decorated with the ImportBindingAttribute that indicates</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     the binding provider to be used with this Activity.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">LoginBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Fragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LoginViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes a new instance of the </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">LoginFragment</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> class.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginFragment</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes a new instance of the </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">LoginFragment</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> class.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">javaReference</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The java reference.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">transfer</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The transfer.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginFragment</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Gets the content layout identifier.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">value</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The content layout identifier.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">value</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">int</span><span style="color: #333333;"> </span><span style="color: #333333;">ContentLayoutId</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Layout</span><span style="color: #333333;">.</span><span style="color: #333333;">main</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes this instance.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">IconId</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Drawable</span><span style="color: #333333;">.</span><span style="color: #333333;">ic_toolbar</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>The FormFragment requires 2 default constructors, which is becoming the new standard for Fragment initialization when using the new Material library. The <strong>ContentLayoutId</strong> defines the layout file that will be used to render this screen. Then the <strong>IconId</strong> is provided for the Toolbar icon that will be used with this view. Then create the <strong>main.axml</strong> layout inside the <strong>XamarinFormsSample.Android/Resources/layout</strong> folder. Use the following layout.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #3364a4;"> </span><span style="color: #333333;">xmlns:android</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">http</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">schemas</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">com</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">apk</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">res</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:orientation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LinearLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:orientation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center_vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginLeft</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">30dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginRight</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">30dp</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">support</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">design</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">widget</span><span style="color: #3364a4;">.TextInputLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EditText</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">TxtUserName</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:singleLine</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:hint</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@string</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">hint_username</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">support</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">design</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">widget</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">TextInputLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">support</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">design</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">widget</span><span style="color: #3364a4;">.TextInputLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EditText</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">TxtPassword</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:singleLine</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:hint</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@string</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">hint_password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">support</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">design</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">widget</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">TextInputLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Button</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">BtnLogin</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:text</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@string</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">login</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #333333;">&gt;</span></span></p>
<p>Similar to previous login form, this screen contains two <strong>EditText</strong>s, with the ID <strong>TxtUserName</strong> and <strong>TxtPassword</strong> respectively. These two <strong>EditText</strong>s are wrapped in inside a <strong>TextInputLayout</strong>. This is a relatively new layout available in Material Design that provides intuitive hinting when used inside a <strong>EditText</strong>. Next, we&#8217;re going bind these textboxes to the ViewModel using the <strong>BindingProvider</strong>.</p>
<p>Create a new BindingProvider inside the <strong>XamarinFormsSample/BindingProviders</strong> folder and call it <strong>LoginBindingProvider</strong>. Use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginBindingProvider</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingProvider</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginBindingProvider</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">TxtUserName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">TextProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">LoginInfo</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">UserName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingMode</span><span style="color: #333333;">.</span><span style="color: #333333;">TwoWay</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">TxtPassword</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">TextProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">LoginInfo</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">Password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingMode</span><span style="color: #333333;">.</span><span style="color: #333333;">TwoWay</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">BtnLogin</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">CommandProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">LoginCommand</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This is the BindingProvider that provides data binding definitions between the View and the ViewModel. We&#8217;re basically binding both of the views with ID <strong>TxtUserName</strong> and <strong>TxtPassword</strong>, bind their Text property to the <strong>LoginInfo.UserName</strong> in the ViewModel. Then we also bind the view with ID <strong>BtnLogin</strong> to the <strong>LoginCommand</strong>.</p>
<blockquote><p>One question we often heard is, why the binding provider is not needed when using Crosslight Form Builder while it&#8217;s needed in native views binding? That&#8217;s because the form metadata automatically map the defined property to the underlying model, and a binding is created behind the scene as the Form Builder generates the views at runtime.</p></blockquote>
<p>Since we&#8217;re no longer using Form Builder for the login screen, you can safely delete the <strong>LoginInfo.FormMetadata</strong> file found inside the <strong>XamarinFormsSample/Forms</strong> folder.</p>
<p><img class="alignnone size-full wp-image-7393" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/form-metadata.png" alt="form-metadata.png" width="250" height="344" /></p>
<p>Next, we need to modify the <strong>LoginViewModel</strong> a bit. Open up the <strong>LoginViewModel.cs</strong> file inside the <strong>XamarinFormsSample/ViewModels</strong> folder and modify the <strong>ExecuteLogin</strong> method. Replace it with the following snippet.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteLogin</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">!</span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">IsNullOrEmpty</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">LoginInfo</span><span style="color: #333333;">.</span><span style="color: #333333;">UserName</span><span style="color: #333333;">)</span><span style="color: #333333;"> </span><span style="color: #333333;">&amp;&amp;</span><span style="color: #333333;"> !</span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">IsNullOrEmpty</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">LoginInfo</span><span style="color: #333333;">.</span><span style="color: #333333;">Password</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">NavigationService</span><span style="color: #333333;">.</span><span style="color: #333333;">Navigate</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">else</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ToastPresenter</span><span style="color: #333333;">.</span><span style="color: #333333;">Show</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Please</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">enter</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">any</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">username</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">and</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">password</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">}</span></span></p>
<p>Also, change the base class of this ViewModel to <strong>ViewModelBase</strong> instead of <strong>EditorViewModelBase</strong>. <strong>EditorViewModelBase</strong> is used when you&#8217;re taking advantage of Crosslight Form Builder&#8217;s capabilities. To learn more about suitable ViewModels to use when designing Crosslight applications, see <a href="http://developer.intersoftsolutions.com/display/crosslight/Selecting+a+ViewModel+Base+Class+to+Get+Started?src=search" target="_blank">Selecting a ViewModelBase Class to Get Started</a>.</p>
<p>This is a similar, but a more manual validation that you can use to validate whether the user has entered any username or password before performing login. One more thing, you can now remove the <strong>Validate</strong> method inside the <strong>Login.cs</strong> located inside the <strong>XamarinFormsSample/Models</strong> folder, since we&#8217;re not using any built-in validation methods.</p>
<p><img class="alignnone size-full wp-image-7406" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/validate.png" alt="validate.png" width="1172" height="400" /></p>
<p>Now you&#8217;re ready to see this feature in action. When you run the project, you should get the following result.</p>
<p><img class="alignnone size-full wp-image-7410" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/login-android.png" alt="login-android.png" width="400" height="1136" /></p>
<p>Now that you&#8217;ve finished the Android sample, let&#8217;s move on to iOS.</p>
<h1>Modifying the iOS Login View</h1>
<p>To modify the iOS sample, let&#8217;s begin by modifying the <strong>LoginViewController </strong>located inside <strong>XamarinFormsSample.iOS/ViewControllers</strong> folder. Use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Storyboard</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">MainStoryboard</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">LoginBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">partial</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginViewController</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UIViewController</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LoginViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes a new instance of the </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">LoginViewController</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> class.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">intPtr</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The int PTR.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginViewController</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">intPtr</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">intPtr</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">bool</span><span style="color: #333333;"> </span><span style="color: #333333;">HideKeyboardOnTap</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>As you can see, for the <strong>LoginViewController</strong>, all you need to do is provide a default constructor that takes in one <strong>IntPtr</strong> object, then decorate the ViewController with the <strong>StoryboardAttribute</strong>. The <strong>&#8220;MainStoryboard&#8221;</strong> string inside the <strong>StoryboardAttribute</strong> indicates the name of the storyboard file that this ViewController will use.</p>
<p>Also notice that we longer subclass from the <strong>UIFormViewController</strong>, but from a simpler <strong>UIViewController</strong> instead. Since we already have the ViewModel and BindingProviders ready, all you need to is create the Storyboard file for this view. Begin by creating a new folder called <strong>Views</strong> inside the iOS project. Then inside the newly created folder, create a new <strong>Storyboard</strong> file called <strong>MainStoryboard.storyboard</strong>. Follow this video to learn how to create a Storyboard file.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/67_daaEbJTc?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>Basically, we&#8217;re creating two <strong>UITextField</strong>s with outlets set to <strong>TxtUserName</strong> and <strong>TxtPassword</strong>. Then we&#8217;re placing a <strong>UIButton</strong> underneath the textboxes, with outlet set to <strong>BtnLogin</strong>, all stacked inside a <strong>StackView</strong>. If you prefer to use the finished storyboard file, you can simply use the file <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightxamarinforms/browse/XamarinFormsSample.iOS/Views/MainStoryboard.storyboard" target="_blank">here</a> and replace it onto your project.</p>
<p>Before you can run this project, you have to make several adjustments, such as ensuring the <strong>Target Deployment</strong> for this project is set at least to <strong>iOS 9 </strong>or higher, this is the due to the usage of the <strong>StackView</strong>. To do this, simply open the <strong>Info.plist</strong> file inside the <strong>XamarinFormsSample.iOS</strong> project.</p>
<p><img class="alignnone size-full wp-image-7445" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/info-plist.png" alt="info-plist.png" width="400" height="400" /></p>
<p>After you&#8217;ve made these adjustments, you should be ready to go. Also, if you try to run this project and it suddenly closes on its own, that means you haven&#8217;t set the compatibility mode to 64-bit for this project. To do this, simply double-click the iOS project and go to <strong>iOS Build</strong> and ensure that the build configuration for <strong>Debug | iPhone Simulator</strong> has been set to the following.</p>
<p><img class="alignnone size-full wp-image-7451" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-22-at-4.59.58-PM.png" alt="Screen Shot 2016-03-22 at 4.59.58 PM.png" width="1848" height="1461" /></p>
<p>After running the sample, you should get the following result.</p>
<p><img class="alignnone size-full wp-image-7454" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/login-ios.png" alt="login-ios.png" width="400" height="1136" /></p>
<h1>Samples</h1>
<p>You can find the finished sample to this tutorial <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightxamarinforms/browse" target="_blank">here</a>. Simply restore the NuGet packages and you&#8217;re ready to go.</p>
<h1>Wrapping Up</h1>
<p>Hopefully this tutorial gives you a brief idea on how data binding works in Crosslight, especially when you&#8217;re binding to native views. By using the native views, you have greater flexibility on how to layout your screen while continue enjoying 100% UI logic sharing.</p>
<p>At this point, you&#8217;ve learned two approaches to build data-bound views in Crosslight. The first is through Form Builder, and the other is through native views. Thankfully, you don&#8217;t have to choose, as you can always mix both of them in your Crosslight project. However, you might be wondering which one does better than the other, and when to use them. <strong>The rule of thumb is</strong>, use Form Builder when you need to rapidly build complex data entry screen such as search screens and editing screens. As for native views, it&#8217;s best for non editable screens such as detail screen which typically require custom layout and design. Native views can also be considered for input screens with fairly few text input such as login screen which is usually highly customized to represent the app&#8217;s branding and styles.</p>
<p class="p1"><span class="s1">If you&#8217;d like to explore further, I highly recommend you to go through each of these topics to quench your thirst:</span></p>
<ul>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Building+Rich+Data+Entry+Form" target="_blank">Building Rich Data Entry Form</a>
<ul>
<li>If you&#8217;d like to get started with the Form Builder, I highly recommend you to look at the two-part blogpost series I wrote up: <a href="http://blog.intersoftsolutions.com/2015/11/getting-started-with-crosslight-form-builder/" target="_blank">Getting Started with Crosslight Form Builder</a> and <a href="http://blog.intersoftsolutions.com/2015/11/extending-crosslight-form-builder-2/" target="_blank">Extending Crosslight Form Builder</a>.</li>
</ul>
</li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Working+with+iOS+Universal+Storyboards" target="_blank">Working with iOS Universal Storyboards</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Crosslight+Android+Material+Development" target="_blank">Crosslight Android Material Development</a></li>
</ul>
<p>Don&#8217;t hesitate to explore the child pages on the documentation as well, as it contains more detailed information on each particular subject. Hopefully this tutorial helps you on grasping the concepts used in Crosslight development and accelerate in building gorgeous cross-platform apps, without sacrificing any user experiences along the way.</p>
<p>Cheers,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2016/03/performing-data-binding-to-native-views-with-crosslight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating from Xamarin.Forms to Crosslight App</title>
		<link>http://blog.intersoftsolutions.com/2016/03/migrating-from-xamarin-forms-to-crosslight-app/</link>
		<comments>http://blog.intersoftsolutions.com/2016/03/migrating-from-xamarin-forms-to-crosslight-app/#comments</comments>
		<pubDate>Tue, 22 Mar 2016 07:52:56 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2016 R1]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Getting Started Guide]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Material]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iOS 9]]></category>
		<category><![CDATA[Xamarin]]></category>
		<category><![CDATA[Xamarin Forms]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=6735</guid>
		<description><![CDATA[Many mobile developers who are just starting out with Crosslight often asked us with this question: I have an existing Xamarin.Forms app and would like to get started with Crosslight. How can I do that? This post aims to provide the answer to that question. However, I&#8217;d [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-vs-crosslight-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="xamarin-vs-crosslight" style="float:right; margin:0 0 10px 10px;" /><p><img class="alignnone size-full wp-image-6831" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-forms-vs-crosslight.png" alt="xamarin-forms-vs-crosslight.png" width="1902" height="986" /></p>
<p>Many mobile developers who are just starting out with Crosslight often asked us with this question: I have an existing Xamarin.Forms app and would like to get started with Crosslight. How can I do that? This post aims to provide the answer to that question. However, I&#8217;d have to be straightforward to you. There&#8217;s no easy way, since Xamarin.Forms isn&#8217;t compatible with Crosslight at all.</p>
<h1>Xamarin.Forms vs. Crosslight</h1>
<p>When should you build with Xamarin.Forms? According to <a href="https://xamarin.com/forms" target="_blank">Xamarin&#8217;s site</a>:</p>
<p><img class="alignnone size-full wp-image-6755" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-native-vs-xamarin-forms.png" alt="xamarin-native-vs-xamarin-forms.png" width="1910" height="1136" /></p>
<p>Well, in our opinion, the best time to use Xamarin.Forms is never to use it all. Why? There are two reasons: user experience and design pattern.</p>
<h2>The User Experience</h2>
<p>Sure, with Xamarin.Forms you can create an app that works. Even though you&#8217;re building a simple app that works, developers should at least pay attention to user experience. If the user experience is bad, prepare to receive 4-or-less-stars all over the App Store and Play Store. How bad is the user experience with Xamarin.Forms? Here&#8217;s two quick videos taken when running the XamarinFormsSample from Xamarin&#8217;s <a href="https://developer.xamarin.com/samples/xamarin-forms/GettingStarted/" target="_blank">Introduction to Xamarin.Forms</a>. One for Android:</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/90xky2TPQoA?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>And another for iOS:</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/4bzhqZo5RS0?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>What do you think? I&#8217;m not even sure where to begin. Xamarin.Forms tries to generalize the user experience for all platforms, which is not a good idea. When the app is first launched, a blank table view is shown. And then when the + button is tapped, a login form is shown. Why not display a login form at the beginning instead? On iOS, I&#8217;m not quite sure I&#8217;ve seen an app that places the Save button side-by-side with the Delete button.  Typically, they&#8217;re placed on the navigation controller as bar items. What&#8217;s worse, when I try to rotate the iOS sample, the bottom section below the image is practically unusable. In Android, when I rotate the device, I&#8217;m automatically kicked back out to the ListView screen and the list seems to be corrupted. Magic. Let&#8217;s compare them with the converted sample to Crosslight.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/SiL5bgiMoCc?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>And here&#8217;s on the one on Android.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/jChXcOtMTmE?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>I&#8217;ll let you be the judge. Take a look with the forms created with Crosslight Form Builder.</p>
<p><img class="alignnone size-full wp-image-7324" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-forms-rotation.png" alt="xamarin-forms-rotation.png" width="2000" height="709" /></p>
<p>With the Form Builder, you can easily create beautiful forms that complies with each platform&#8217;s user experience guidelines. And they&#8217;re all working correctly without any annoying user experience found in Xamarin.Forms. Buttons are correctly placed and rotation works perfectly. This is what a &#8220;minimal-working&#8221; app should look like.</p>
<h2>The Design Pattern</h2>
<p>Let&#8217;s take a brief look at the Xamarin.Forms code for the editor screen. Click on the image to see the large version.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-forms-code.png"><img class="alignnone size-full wp-image-7323" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-forms-code.png" alt="xamarin-forms-code.png" width="1603" height="2000" /></a></p>
<p>As you can see, Crosslight Form Builder showcases a better pattern where you design a form focused more on the model, rather than the View, as the View approach will not produce native-looking forms when used in cross-platform fashion. With Crosslight, developers are focused on models, making the View loosely-coupled. This will also lead in better long-term extensibility and clearer separation of concerns. Also, you&#8217;ll notice that the code to build forms are much lighter and shorter.</p>
<blockquote><p>It&#8217;s important to note that Form Builder is only one of many features available in Crosslight. In addition to Form Builder, developers can use Crosslight&#8217;s advanced data binding features to bind native views to a shared ViewModel and enjoy 100% UI logic reuse. However, this post specifically highlights the Form Builder feature to provide a comparable approach to Xamarin Forms.</p></blockquote>
<p>In this tutorial, I&#8217;m going to convert the existing sample XamarinFormsSample to Crosslight. In high-level overview, here&#8217;s what we&#8217;re going to accomplish:</p>
<ul>
<li>Add bootstrapper files for Android.</li>
<li>Remove Xamarin.Forms references.</li>
<li>Begin creating the views and ViewModels</li>
<li>Add bootstrapper files and views for Android.</li>
<li>Add bootstrapper files and views for iOS.</li>
</ul>
<p>Sounds good? Let&#8217;s begin.</p>
<h1>What You&#8217;ll Need</h1>
<p>To accomplish this tutorial perfectly, you&#8217;ll need to download the initial project from Xamarin&#8217;s website. Grab it <a href="https://developer.xamarin.com/samples/xamarin-forms/GettingStarted/GettingStarted.zip" target="_blank">here</a>. Extract the files and use only the <strong>XamarinFormsSample</strong> project.</p>
<p><img class="alignnone size-full wp-image-6865" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-9.37.20-AM.png" alt="Screen Shot 2016-03-18 at 9.37.20 AM.png" width="1764" height="1096" /></p>
<p>Open the .sln file and we&#8217;ll start from there. If you&#8217;re on Mac, you&#8217;ll need to have your Mobile Studio 2016 or higher installed on your Mac, since we&#8217;re going to be installing NuGet references via Xamarin Studio.</p>
<p>If you&#8217;re on Windows with Visual Studio, you should be able to follow this tutorial through without any hassles, since NuGet package management is built-in right into Visual Studio. You&#8217;ll also need to use at least Crosslight 5.0.5000.569 or higher. This package is available in the NuGet repository. We&#8217;ll add this package in the next step.</p>
<h1>Install Crosslight Packages</h1>
<p>Let&#8217;s begin by installing the necessary Crosslight references to these projects. If you&#8217;re on Mac, start by opening the <strong>Intersoft Package Console Extension</strong> from Xamarin Studio.</p>
<p><img class="alignnone size-full wp-image-6887" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/intersoft-package-console-extension.png" alt="intersoft-package-console-extension.png" width="1550" height="1028" /></p>
<ul>
<li>Install Intersoft.Crosslight package to all of your projects.<br />
<img class="alignnone size-full wp-image-6889" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/install-crosslight.png" alt="install-crosslight.png" width="1362" height="484" /></li>
<li>Install Intersoft.Crosslight.Android.v7 to the Android project.<br />
<img class="alignnone size-full wp-image-6891" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/install-crosslight-android-v7.png" alt="install-crosslight-android-v7.png" width="1468" height="480" /></li>
</ul>
<p>If you&#8217;re unfamiliar with installing Crosslight NuGet packages, it is highly recommended to check out the docs: <a href="http://developer.intersoftsolutions.com/display/crosslight/Introduction+to+Crosslight+NuGet+Packages" target="_blank">Introduction to Crosslight NuGet Packages</a>.</p>
<h1>Remove Xamarin.Forms References</h1>
<p>As radical as it seems, Crosslight is not designed to work with Xamarin.Forms, and therefore all Xamarin.Forms references have to be removed. Remove these highlighted references from your project.</p>
<p><img class="alignnone size-full wp-image-6897" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/remove-xamarin-forms.png" alt="remove-xamarin-forms.png" width="1588" height="734" /></p>
<p>After you&#8217;ve removed these references, make sure to double check the References folder once more, because there might be additional references such as these, which you need to remove as well.</p>
<p><img class="alignnone size-full wp-image-6903" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-forms-references.png" alt="xamarin-forms-references.png" width="250" height="262" /></p>
<p>Also, remove the <strong>Views</strong> folder from the <strong>XamarinFormsSample</strong> (PCL) project entirely and including the <strong>Colours.cs</strong> and <strong>Fonts.cs</strong>.</p>
<p><img class="alignnone size-full wp-image-6957" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/remove-unnecessary-files-pcl.png" alt="remove-unnecessary-files-pcl.png" width="250" height="660" /></p>
<p>Also, you might want to remove references to <strong>Xamarin.Forms</strong> inside the <strong>packages.config</strong> that exists in each project, so you can easily update Crosslight assemblies for this project without the Xamarin.Forms references re-appearing each time.</p>
<p>&nbsp;</p>
<h1>Bootstrapping the PCL Project</h1>
<p>Add a new folder called <strong>Infrastructure</strong> inside the <strong>XamarinFormsSample</strong> (PCL) project and an empty class called <strong>AppService.cs.</strong></p>
<p><img class="alignnone size-full wp-image-6921" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/app-service.png" alt="app-service.png" width="250" height="264" /></p>
<p>Then replace the contents as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #c44c57;">Core</span><span style="color: #333333;">.</span><span style="color: #c44c57;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Infrastructure</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Crosslight&#8217;s shared application initializer.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     This is the perfect place to register repositories, custom services, and other dependencies via IoC.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">Intersoft</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Crosslight</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">ApplicationServiceBase</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">sealed</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CrosslightAppAppService</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ApplicationServiceBase</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes a new instance of the </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">CrosslightAppAppService</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> class.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">context</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The application context that implements </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">T</span><span style="font-style: italic; color: #888888;">:</span><span style="font-style: italic; color: #888888;">Intersoft</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Crosslight</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">IApplicationContext</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CrosslightAppAppService</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationContext</span><span style="color: #333333;"> </span><span style="color: #333333;">context</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">context</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Called when the application is starting.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">parameter</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The startup parameters.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">OnStart</span><span style="color: #333333;">(</span><span style="color: #3364a4;">StartParameter</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">OnStart</span><span style="color: #333333;">(</span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;">Specify</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">first</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">ViewModel</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">to</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">use</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">when</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">launching</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">application</span><span style="font-style: italic; color: #888888;">.</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SetRootViewModel</span><span style="color: #333333;">&lt;</span><span style="color: #c44c57;">LoginViewModel</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This is the application service for the Core project, which is the perfect place to register custom services and additional dependencies via IoC. In this project, we won&#8217;t add anything except for just simple constructor that takes in one <strong>IApplicationContext</strong> parameter. This is the default constructor for this class. Also, in the overridden OnStart method, we&#8217;ve defined the root ViewModel as <strong>LoginViewModel</strong>, which we will create in just a moment.</p>
<p>Next, add another empty class inside the <strong>Models</strong> folder and give it a name of <strong>ModelBase.cs</strong>.</p>
<p><img class="alignnone size-full wp-image-6929" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/model-base.png" alt="model-base.png" width="250" height="414" /></p>
<p>Replace the content as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Collections</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Collections</span><span style="color: #333333;">.</span><span style="color: #333333;">Generic</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">ComponentModel</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Linq</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Models</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     A handy model class that conforms to Crosslight lifecycle.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Most of the time you will only need to subclass this class when introducing a new domain model.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Includes validation features as well.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">System</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">ComponentModel</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">INotifyPropertyChanged</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">System</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">ComponentModel</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">INotifyDataErrorInfo</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">Intersoft</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Crosslight</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">IDataValidation</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ModelBase</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">INotifyPropertyChanged</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">INotifyDataErrorInfo</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IDataValidation</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Fields</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">readonly</span><span style="color: #333333;"> </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ValidationResult</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ValidationResult</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Gets a value that indicates whether the entity has validation errors.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">virtual</span><span style="color: #333333;"> </span><span style="color: #009695;">bool</span><span style="color: #333333;"> </span><span style="color: #333333;">HasErrors</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">.</span><span style="color: #333333;">Count</span><span style="color: #333333;">(</span><span style="color: #333333;">o</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> !</span><span style="color: #333333;">o</span><span style="color: #333333;">.</span><span style="color: #333333;">IsSuccess</span><span style="color: #333333;">)</span><span style="color: #333333;"> </span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #f57d00;">0</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Clears all errors.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ClearAllErrors</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #009695;">string</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">properties</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #009695;">string</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">var</span><span style="color: #333333;"> result </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">var</span><span style="color: #333333;"> member </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">result</span><span style="color: #333333;">.</span><span style="color: #333333;">MemberNames</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">!</span><span style="color: #333333;">properties</span><span style="color: #333333;">.</span><span style="color: #333333;">Contains</span><span style="color: #333333;">(</span><span style="color: #333333;">member</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                        </span><span style="color: #333333;">properties</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #333333;">member</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">.</span><span style="color: #333333;">Clear</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnErrorsChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> property </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">properties</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">property</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Clears the error.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">propertyName</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">Name of the property.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ClearError</span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">var</span><span style="color: #333333;"> </span><span style="color: #333333;">emptyValidationResult</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ValidationResult</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">var</span><span style="color: #333333;"> result </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">result</span><span style="color: #333333;">.</span><span style="color: #333333;">MemberNames</span><span style="color: #333333;">.</span><span style="color: #333333;">Contains</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">((</span><span style="color: #3364a4;">IList</span><span style="color: #333333;">)</span><span style="color: #333333;"> </span><span style="color: #333333;">result</span><span style="color: #333333;">.</span><span style="color: #333333;">MemberNames</span><span style="color: #333333;">)</span><span style="color: #333333;">.</span><span style="color: #333333;">Remove</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">                    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">!</span><span style="color: #333333;">result</span><span style="color: #333333;">.</span><span style="color: #333333;">MemberNames</span><span style="color: #333333;">.</span><span style="color: #333333;">Any</span><span style="color: #333333;">())</span><br />
<span style="color: #333333;">                        </span><span style="color: #333333;">emptyValidationResult</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #333333;">result</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">var</span><span style="color: #333333;"> result </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">emptyValidationResult</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">.</span><span style="color: #333333;">Remove</span><span style="color: #333333;">(</span><span style="color: #333333;">result</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnErrorsChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Gets all errors.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IEnumerable</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ValidationResult</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">GetAllErrors</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">.</span><span style="color: #333333;">Where</span><span style="color: #333333;">(</span><span style="color: #333333;">o</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> !</span><span style="color: #333333;">o</span><span style="color: #333333;">.</span><span style="color: #333333;">IsSuccess</span><span style="color: #333333;">)</span><span style="color: #333333;">.</span><span style="color: #333333;">ToList</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Gets the validation errors for a specified property or for the entire entity.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">propertyName</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The name of the property to retrieve validation errors for; or null or</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">F</span><span style="font-style: italic; color: #888888;">:</span><span style="font-style: italic; color: #888888;">System</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">String</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Empty</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">, to retrieve entity-level errors.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The validation errors for the property or entity.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IEnumerable</span><span style="color: #333333;"> </span><span style="color: #333333;">GetErrors</span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">var</span><span style="color: #333333;"> </span><span style="color: #333333;">validationResult</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ValidationResult</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">var</span><span style="color: #333333;"> result </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">((</span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">IsNullOrEmpty</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><span style="color: #333333;"> || </span><span style="color: #333333;">result</span><span style="color: #333333;">.</span><span style="color: #333333;">MemberNames</span><span style="color: #333333;">.</span><span style="color: #333333;">Contains</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">))</span><span style="color: #333333;"> </span><span style="color: #333333;">&amp;&amp;</span><span style="color: #333333;"> !</span><span style="color: #333333;">result</span><span style="color: #333333;">.</span><span style="color: #333333;">IsSuccess</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">validationResult</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #333333;">result</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">validationResult</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Called when [errors changed].</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">propertyName</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">Name of the property.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">virtual</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">OnErrorsChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnErrorsChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DataErrorsChangedEventArgs</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Raises the </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">E</span><span style="font-style: italic; color: #888888;">:</span><span style="font-style: italic; color: #888888;">ErrorsChanged</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> event.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">e</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">DataErrorsChangedEventArgs</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> instance containing the event data.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">OnErrorsChanged</span><span style="color: #333333;">(</span><span style="color: #3364a4;">DataErrorsChangedEventArgs</span><span style="color: #333333;"> </span><span style="color: #333333;">e</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">var</span><span style="color: #333333;"> </span><span style="color: #333333;">handler</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ErrorsChanged</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">handler</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">handler</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">e</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Called when [property changed].</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">propertyName</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">Name of the property.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">virtual</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">PropertyChangedEventArgs</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Raises the </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">E</span><span style="font-style: italic; color: #888888;">:</span><span style="font-style: italic; color: #888888;">PropertyChanged</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> event.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">e</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">PropertyChangedEventArgs</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;"> instance containing the event data.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #3364a4;">PropertyChangedEventArgs</span><span style="color: #333333;"> </span><span style="color: #333333;">e</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">var</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyChanged</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">PropertyChanged</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">propertyChanged</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">propertyChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">e</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Raises the property changed.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">propertyName</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">Name of the property.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">RaisePropertyChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Sets the error.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">errorMessage</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The error message.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">propertyName</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">Name of the property.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">SetError</span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">errorMessage</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">_validationResultList</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ValidationResult</span><span style="color: #333333;">(</span><span style="color: #333333;">errorMessage</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">propertyName</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnErrorsChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">propertyName</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Validate this instance.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">virtual</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Validate</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">INotifyDataErrorInfo</span><span style="color: #c12dac;"> Members</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Occurs when the validation errors have changed for a property or for the entire entity.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">event</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EventHandler</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">DataErrorsChangedEventArgs</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">ErrorsChanged</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">INotifyPropertyChanged</span><span style="color: #c12dac;"> Members</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Occurs when a property value changes.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">event</span><span style="color: #333333;"> </span><span style="color: #3364a4;">PropertyChangedEventHandler</span><span style="color: #333333;"> </span><span style="color: #333333;">PropertyChanged</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This is the base class used for domain models used with Crosslight projects that supports <strong>INotifyPropertyChanged</strong> for data binding and also data validation. It is highly recommended that the models used in the project subclasses this <strong>ModelBase</strong> class. Let&#8217;s modify the existing models now and do that. Open up <strong>Employee.cs</strong> and replace the contents as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Models</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     This is a domain object that holds information about a given employee.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">partial</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ModelBase</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">ImageUri</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">VC</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Fields</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">_firstName</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">_imageUri</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">_lastName</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">_twitter</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">DisplayName</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">Format</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #ff0000;">{</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">}</span><span style="color: #f57d00;">,</span><span style="color: #f57d00;"> </span><span style="color: #ff0000;">{</span><span style="color: #ff0000;">1</span><span style="color: #ff0000;">}</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">_lastName</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">_firstName</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">FirstName</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_firstName</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">value</span><span style="color: #333333;">.</span><span style="color: #333333;">Equals</span><span style="color: #333333;">(</span><span style="color: #333333;">_firstName</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StringComparison</span><span style="color: #333333;">.</span><span style="color: #333333;">Ordinal</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_firstName</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">DisplayName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">ImageUri</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_imageUri</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">value</span><span style="color: #333333;">.</span><span style="color: #333333;">Equals</span><span style="color: #333333;">(</span><span style="color: #333333;">_imageUri</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StringComparison</span><span style="color: #333333;">.</span><span style="color: #333333;">Ordinal</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_imageUri</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">ImageUri</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">LastName</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_lastName</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">value</span><span style="color: #333333;">.</span><span style="color: #333333;">Equals</span><span style="color: #333333;">(</span><span style="color: #333333;">_lastName</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StringComparison</span><span style="color: #333333;">.</span><span style="color: #333333;">Ordinal</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_lastName</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">DisplayName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">Twitter</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_twitter</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">value</span><span style="color: #333333;">.</span><span style="color: #333333;">Equals</span><span style="color: #333333;">(</span><span style="color: #333333;">_twitter</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StringComparison</span><span style="color: #333333;">.</span><span style="color: #333333;">Ordinal</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_twitter</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Twitter</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>In this code, note the <strong>partial</strong> modifier for this class. This is needed for the Crosslight Form Builder metadata, which we&#8217;ll create much later in the tutorial. Then modify <strong>LoginInfo.cs</strong> as well.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">ComponentModel</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">.</span><span style="color: #333333;">CompilerServices</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Models</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">   This class is used to capture login credentials and to perform very simple authentication.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">partial</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginInfo</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ModelBase</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">_password</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">Empty</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">_username</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">Empty</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">UserName</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_username</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">_username</span><span style="color: #333333;">.</span><span style="color: #333333;">Equals</span><span style="color: #333333;">(</span><span style="color: #009695;">value</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StringComparison</span><span style="color: #333333;">.</span><span style="color: #333333;">Ordinal</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_username</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;"> </span><span style="color: #333333;">??</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">Empty</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">UserName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">Password</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_password</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">_password</span><span style="color: #333333;">.</span><span style="color: #333333;">Equals</span><span style="color: #333333;">(</span><span style="color: #009695;">value</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StringComparison</span><span style="color: #333333;">.</span><span style="color: #333333;">Ordinal</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_password</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;"> </span><span style="color: #333333;">??</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">Empty</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Validate</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ClearAllErrors</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">IsNullOrEmpty</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">UserName</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SetError</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Please</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">enter</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">any</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">username</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">UserName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">string</span><span style="color: #333333;">.</span><span style="color: #333333;">IsNullOrEmpty</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Password</span><span style="color: #333333;">))</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SetError</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Please</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">enter</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">any</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>The Validate method shown in the above snippet code is one of the examples how you can perform validation in Crosslight Form Builder. Here, we set the error message when user did not enter any username or password in the form upon login. Although, there is a more advanced version of form validation with the Crosslight Form Builder, that is to use the <strong>EntityMetadataAttribute. </strong>However, it will be covered in a separate blog post.</p>
<h1>Creating the Login Screen</h1>
<p>If you notice from the original sample, user can&#8217;t perform any operation unless they&#8217;ve performed login. Let&#8217;s modify the sample a bit to show the login screen at the initial state. So we&#8217;ll prepare the login screen first, then try to create the login screen on the Android platform. We&#8217;ll also bootstrap the Android project along the way.</p>
<p>Create a new folder in the <strong>XamarinFormsSample</strong> (PCL) project and give it a name of <strong>ViewModels</strong>. Then create a new <strong>Crosslight View Model</strong> in the folder, called <strong>LoginViewModel</strong>.</p>
<p><img class="alignnone size-full wp-image-6967" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-loginviewmodel.png" alt="add-loginviewmodel.png" width="250" height="458" /></p>
<p>Replace the entire contents as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Input</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditorViewModelBase</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LoginInfo</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginViewModel</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Item</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginInfo</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">LoginCommand</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DelegateCommand</span><span style="color: #333333;">(</span><span style="color: #333333;">ExecuteLogin</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Fields</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginInfo</span><span style="color: #333333;"> </span><span style="color: #333333;">_loginInfo</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DelegateCommand</span><span style="color: #333333;"> </span><span style="color: #333333;">LoginCommand</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">get</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #009695;">set</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginInfo</span><span style="color: #333333;"> </span><span style="color: #333333;">LoginInfo</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_loginInfo</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">set</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">_loginInfo</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">_loginInfo</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">value</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">OnPropertyChanged</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">LoginInfo</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteLogin</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>In the constructor of this ViewModel, we&#8217;ve just simply instantiated a new <strong>LoginInfo</strong> object model, a new <strong>DelegateCommand</strong> <strong>LoginCommand</strong> and the <strong>Title</strong> for the ViewModel. We&#8217;ll leave the ExecuteLogin method as empty for now, all we want to accomplish now is displaying the Login screen perfectly. We&#8217;ll modify this method later on. Save this file and rebuild try to rebuild the <strong>XamarinFormsSample</strong> (PCL) project.</p>
<p><img class="alignnone size-full wp-image-6979" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-11.40.16-AM.png" alt="Screen Shot 2016-03-18 at 11.40.16 AM.png" width="3104" height="1842" /></p>
<p>You&#8217;ll get the error as shown in the shot above. This is because we&#8217;ve removed all references to Xamarin.Forms. We can completely remove this file, however, you might want to keep the <strong>Employees</strong> property in this file somewhere, perhaps in a separate notepad file for now. We&#8217;re going to need this for the list of employees later after we&#8217;ve successfully created the login module.</p>
<p><img class="alignnone size-full wp-image-6984" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-11.42.20-AM.png" alt="Screen Shot 2016-03-18 at 11.42.20 AM.png" width="2282" height="1342" /></p>
<p>Delete <strong>App.cs</strong> when you&#8217;re done. Rebuild the <strong>XamarinFormsSample</strong> (PCL) project one more time and you should be able to build it now.</p>
<p><img class="alignnone size-full wp-image-6989" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/pcl-build-successful.png" alt="pcl-build-successful.png" width="1976" height="266" /></p>
<p>Great! Let&#8217;s create the Android login view for this ViewModel.</p>
<h1>Bootstrapping the Android Project</h1>
<p>Before we can use this project, we need to &#8220;upgrade&#8221; this project to use new project standards. Let&#8217;s go through each step carefully, one step at a time.</p>
<p>Download this <a href="http://developer.intersoftsolutions.com/display/crosslight/Migrating+from+Crosslight+Android+Classic?preview=%2F23702119%2F24309664%2Fmipmap.zip" target="_blank">mipmap.zip</a> file and extract it. These files will be used as the launcher icons for our Android project. Import them into the <strong>Resources</strong> folder by using <strong>Add Existing Folder</strong> menu. What these mipmap icons do is provide a better high-res icons for the app launchers. For example, if your device is on the hdpi-display scale, then it will use the xhdpi icons for the icon launchers so that it will look crisp.</p>
<p><img class="alignnone size-full wp-image-7017" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-existing-folder.png" alt="add-existing-folder.png" width="1240" height="316" /></p>
<p>Select each mipmap folder so that your project looks as follows.</p>
<p><img class="alignnone size-full wp-image-7019" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/mipmap.png" alt="mipmap.png" width="250" height="656" /></p>
<p>Start by opening the <strong>Android</strong> project Options. To do this, right-click on the Android project and choose <strong>Options</strong>.</p>
<p><img class="alignnone size-full wp-image-6997" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/android-project-options.png" alt="android-project-options.png" width="500" height="1050" /></p>
<p>In the dialog that appears, choose <strong>Main Settings</strong> and change the <strong>Default Namespace</strong> to <strong>XamarinFormsSample.Android</strong>.</p>
<p><img class="alignnone size-full wp-image-7108" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-5.08.51-PM.png" alt="Screen Shot 2016-03-18 at 5.08.51 PM.png" width="1794" height="1292" /></p>
<p>Then choose <strong>General</strong>, ensure that the <strong>Target Framework</strong> has been set to <strong>Android 5.0 (Lollipop)</strong>.</p>
<p><img class="alignnone size-full wp-image-7003" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-11.50.17-AM.png" alt="Screen Shot 2016-03-18 at 11.50.17 AM.png" width="1779" height="1378" /></p>
<p>Next, in the <strong>Android Build</strong> menu, the <strong>Advanced</strong> tab, ensure that the all <strong>Supported ABIs</strong> are ticked for both <strong>Debug</strong> and <strong>Release</strong> configurations.</p>
<p><img class="alignnone size-full wp-image-7005" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-11.51.31-AM.png" alt="Screen Shot 2016-03-18 at 11.51.31 AM.png" width="1814" height="1413" /></p>
<p>In the next menu, change the <strong>Application icon</strong> to <strong>@mipmap/Icon</strong>. This corresponds to the mipmap folders that we&#8217;ve just imported.</p>
<p><img class="alignnone size-full wp-image-7023" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-3.50.17-PM.png" alt="Screen Shot 2016-03-18 at 3.50.17 PM.png" width="1744" height="1373" /></p>
<p>You can also ensure that the <strong>Target Android</strong> version is set to <strong>Android 5.0 </strong>or higher. Next, open up <strong>AndroidManifest.xml</strong> located inside <strong>Properties</strong> folder. Change the current theme to <strong>@style/Theme.Crosslight.Material.Light</strong>.</p>
<p><img class="alignnone size-full wp-image-7136" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/android-theme-material.png" alt="android-theme-material.png" width="1174" height="294" /></p>
<p>Next, create a new <strong>Activities</strong> folder inside the Android project and move the <strong>MainActivity.cs</strong> there.</p>
<p><img class="alignnone size-full wp-image-7036" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/main-activity.png" alt="main-activity.png" width="250" height="460" /></p>
<p>Rename this file as <strong>LaunchActivity.cs</strong> and replace the contents as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">App</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The splash screen Activity. To change the launcher icon for the Android app, simply change the Icon property.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">Intersoft</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Crosslight</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Android</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">StartActivity</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Activity</span><span style="color: #333333;">(</span><span style="color: #333333;">Label </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">XamarinFormSample</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">Android</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> MainLauncher </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">,</span><span style="color: #333333;"> NoHistory </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">,</span><span style="color: #333333;"> Icon </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@mipmap</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">icon</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> Theme </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@style</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Theme</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">Splash</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LaunchActivity</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">StartActivity</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This is just the splash screen that will be launched when the Android app is run. Since we&#8217;ve used a new Theme here, let&#8217;s add the styles to our <strong>Resources</strong> folder. Add a new styles.xml file inside the <strong>Resources/values</strong> folder.</p>
<p><img class="alignnone size-full wp-image-7046" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/styles.png" alt="styles.png" width="200" height="656" /></p>
<p>Add the following entry to the <strong>styles.xml</strong> file.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">resources</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">style</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Theme</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">Splash</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">parent</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">Theme</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">      </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">item</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">windowBackground</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">@drawable/light_splash</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">item</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">item</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">windowNoTitle</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">true</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">item</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">style</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">resources</span><span style="color: #333333;">&gt;</span></span></p>
<p>And also add the following <strong>light_splash.png</strong> drawable to your <strong>Resources/drawable</strong> folder.</p>
<p><img class="alignnone size-full wp-image-7050" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/light_splash.png" alt="light_splash.png" width="250" height="960" /></p>
<p>Next, add a new folder in the root directory of the Android project, called <strong>Infrastructure</strong>. Then add a new empty class called <strong>AppInitializer</strong>.</p>
<p><img class="alignnone size-full wp-image-7123" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/android-appinitializer.png" alt="android-appinitializer.png" width="200" height="418" /></p>
<p>Replace the contents of the <strong>AppInitializer.cs</strong> as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Infrastructure</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Infrastructure</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Android Application Initializer class.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">Intersoft</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Crosslight</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">IApplicationInitializer</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">sealed</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppInitializer</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IApplicationInitializer</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">Implementation</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">of</span><span style="color: #c12dac;"> IApplicationInitializer</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Gets the application service based on the current context.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">context</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The context of the application.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The application service.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IApplicationService</span><span style="color: #333333;"> </span><span style="color: #333333;">GetApplicationService</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationContext</span><span style="color: #333333;"> </span><span style="color: #333333;">context</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CrosslightAppAppService</span><span style="color: #333333;">(</span><span style="color: #333333;">context</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes and prepares the application for launch.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">appHost</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The application host.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">InitializeApplication</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationHost</span><span style="color: #333333;"> </span><span style="color: #333333;">appHost</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes the components required for the application to run properly.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">appHost</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The application host.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">InitializeComponents</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationHost</span><span style="color: #333333;"> </span><span style="color: #333333;">appHost</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes the services for the application to start properly.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">appHost</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The application host.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">InitializeServices</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationHost</span><span style="color: #333333;"> </span><span style="color: #333333;">appHost</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This file is the application initializer for Android, useful for registering custom Android services, views, and Form Builder components. We&#8217;ll leave this class as it is for now.</p>
<p>To create the login view for Android, we&#8217;re going to take advantage of the Crosslight Form which will help us create the login screen very quickly. Begin by creating a new folder inside the <strong>XamarinFormsSample</strong> (PCL) project called <strong>Forms</strong>. Then create a new empty class called <strong>LoginInfo.FormMetadata.cs</strong> inside the newly created folder. Use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Forms</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">FormMetadataType</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">LoginInfo</span><span style="color: #333333;">.</span><span style="color: #3364a4;">FormMetadata</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">partial</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginInfo</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Form</span><span style="color: #333333;">(</span><span style="color: #333333;">Title </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Login</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FormMetadata</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Section</span><span style="color: #333333;">]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginSection</span><span style="color: #333333;"> </span><span style="color: #333333;">LoginSection</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginSection</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Layout</span><span style="color: #333333;">(</span><span style="color: #333333;">Style </span><span style="color: #333333;">=</span><span style="color: #333333;"> LayoutStyle</span><span style="color: #333333;">.</span><span style="color: #333333;">DetailOnly</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">StringInput</span><span style="color: #333333;">(</span><span style="color: #333333;">Placeholder </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Username</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">UserName</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Layout</span><span style="color: #333333;">(</span><span style="color: #333333;">Style </span><span style="color: #333333;">=</span><span style="color: #333333;"> LayoutStyle</span><span style="color: #333333;">.</span><span style="color: #333333;">DetailOnly</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">StringInput</span><span style="color: #333333;">(</span><span style="color: #333333;">Placeholder </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Display</span><span style="color: #333333;">(</span><span style="color: #333333;">Caption </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Password</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">Password</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Editor</span><span style="color: #333333;">(</span><span style="color: #333333;">EditorType</span><span style="color: #333333;">.</span><span style="color: #333333;">Button</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Display</span><span style="color: #333333;">(</span><span style="color: #333333;">Caption </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Login</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Binding</span><span style="color: #333333;">(</span><span style="color: #333333;">Path </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">LoginCommand</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> SourceType </span><span style="color: #333333;">=</span><span style="color: #333333;"> BindingSourceType</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModel</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Button</span><span style="color: #333333;">(</span><span style="color: #333333;">Title </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Login</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> TextColor </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">#</span><span style="color: #f57d00;">FF285AFF</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> Style </span><span style="color: #333333;">=</span><span style="color: #333333;"> ButtonStyle</span><span style="color: #333333;">.</span><span style="color: #333333;">Simple</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">LoginButton</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This is the FormMetadata that will be used for our login screen. This class is decorated with the <strong>FormMetadataTypeAttribute</strong> class which will indicate that this class will be used for the Form Builder definition. Also note that this class is a partial class from the <strong>LoginInfo</strong> model found inside the <strong>XamarinFormsSample/Models</strong> folder. Here, we only have a single <strong>LoginSection</strong> which consists of the following UI elements:</p>
<ul>
<li>Text box for the UserName</li>
<li>Text box for the Password</li>
<li>Button for the Login button.</li>
</ul>
<p>It is recommended to match the property name with the model to ensure Form Builder automatic validation. The login button is also bound to the <strong>LoginCommand</strong> in the <strong>LoginViewModel</strong>.</p>
<p>Add a new <strong>Crosslight Android Material Activity</strong> inside the <strong>Activities</strong> folder.</p>
<p><img class="alignnone size-full wp-image-7061" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/loginactivity.png" alt="loginactivity.png" width="250" height="336" /></p>
<p>Give it a name of <strong>LoginActivity</strong>.</p>
<p><img class="alignnone size-full wp-image-7059" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-18-at-4.40.00-PM.png" alt="Screen Shot 2016-03-18 at 4.40.00 PM.png" width="1640" height="1298" /></p>
<p>Replace the contents of <strong>LoginActivity.cs</strong> as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">App</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Activities</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The main activity that acts as the host for LoginFragment.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Activity</span><span style="color: #333333;">]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginActivity</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppCompatActivity</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LoginViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginActivity</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginActivity</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This Activity will act as a container for the <strong>LoginFragment</strong>, which is the real view that&#8217;s being rendered for the login screen. Create a new folder called <strong>Fragments</strong> at the root of the Android project.</p>
<p><img class="alignnone size-full wp-image-7070" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/fragments.png" alt="fragments.png" width="250" height="332" /></p>
<p>Create a new <strong>Crosslight Android Material Form Fragment</strong> in this folder, called <strong>LoginFragment</strong>.</p>
<p><img class="alignnone size-full wp-image-7325" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-22-at-1.35.42-PM.png" alt="Screen Shot 2016-03-22 at 1.35.42 PM.png" width="1681" height="1311" /></p>
<p>Paste the following code into <strong>LoginFragment</strong>.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Fragments</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The main Fragment contained inside LoginActivity.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">LoginFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FormFragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LoginViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes this instance.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">IconId</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Drawable</span><span style="color: #333333;">.</span><span style="color: #333333;">ic_toolbar</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This project contains nothing except for the icon that will be used in the toolbar. When trying to run the project, you&#8217;ll get an error that <strong>ic_toolbar</strong> cannot be found. This can be easily resolved by copying the following image to the <strong>Resources/drawable</strong> folder.</p>
<p><img class="alignnone size-full wp-image-7115" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/ic_toolbar1.png" alt="ic_toolbar.png" width="48" height="48" /></p>
<p>The above is white and transparent, which makes it might be hard to see, but this icon will fit to almost Material Toolbar color you throw at it, except for white color, of course. You can replace this icon later with your own app branding, if you&#8217;d like.</p>
<p>If you build and run the project now, you should get the following screen.</p>
<p><img class="alignnone size-full wp-image-7142" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/android-result1.png" alt="android-result.png" width="400" height="1136" /></p>
<p>When you click on the Login button, nothing will happen for now, since we&#8217;ve omitted the logic for <strong>ExecuteLogin</strong> in the <strong>LoginViewModel</strong>.</p>
<h1>Preparing the Employee List Screen</h1>
<p>Now that we&#8217;ve successfully displayed the login screen, we&#8217;re going to further modify this sample to navigate to the list of employees screen after we&#8217;ve clicked on the Login button. Start by modifying the <strong>LoginViewModel</strong> located inside the <strong>XamarinFormsSample</strong> (PCL) project. Use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteLogin</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Validate</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #333333;">    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">!</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">HasErrors</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">NavigationService</span><span style="color: #333333;">.</span><span style="color: #333333;">Navigate</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">else</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">MessagePresenter</span><span style="color: #333333;">.</span><span style="color: #333333;">Show</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ErrorMessage</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">}</span></p>
<p>Here, we simply invoke the <strong>Validate</strong> method that is built-in to the <strong>EditorViewModelBase</strong>. If there&#8217;s any errors, then it will be displayed using the built-in message presenter that comes with the <strong>ViewModelBase</strong>. If the user has indeed entered any values, then the app will navigate to the employee list screen. Create a new Editable List View Model under the <strong>XamarinFormsSample/ViewModels</strong> folder. Give it a name of <strong>EmployeeListViewModel</strong>.</p>
<p><img class="alignnone size-full wp-image-7158" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-9.34.27-AM.png" alt="Screen Shot 2016-03-21 at 9.34.27 AM.png" width="1626" height="1295" /></p>
<p>Use the following code:</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Collections</span><span style="color: #333333;">.</span><span style="color: #333333;">Generic</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Collections</span><span style="color: #333333;">.</span><span style="color: #333333;">ObjectModel</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Linq</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditableListViewModelBase</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SourceItems</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Employees</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Title</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Employee</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">List</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Fields</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ObservableCollection</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">_employees</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ObservableCollection</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">Employees</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">_employees</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_employees</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">list</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">List</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                        FirstName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Cecil</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        LastName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Kinross</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        ImageUri </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">CecilKinross</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">}</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                        FirstName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">William</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        LastName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Hall</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        ImageUri </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">WilliamHall</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">}</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                        FirstName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Robert</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        LastName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Spall</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        ImageUri </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">RobertSpall</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">}</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                        FirstName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Ernest</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        LastName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Smith</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        ImageUri </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">ErnestSmith</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">}</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                        FirstName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Paul</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        LastName </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Triquet</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                        ImageUri </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">PaulTriquet</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">                </span><span style="color: #009695;">int</span><span style="color: #333333;"> </span><span style="color: #333333;">counter</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">1</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;"> employee </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">list</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    </span><span style="color: #333333;">employee</span><span style="color: #333333;">.</span><span style="color: #333333;">Twitter</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@fake</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">+</span><span style="color: #333333;"> </span><span style="color: #333333;">counter</span><span style="color: #333333;">++;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">_employees</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ObservableCollection</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;(</span><span style="color: #333333;">list</span><span style="color: #333333;">.</span><span style="color: #333333;">OrderBy</span><span style="color: #333333;">(</span><span style="color: #333333;">e</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">e</span><span style="color: #333333;">.</span><span style="color: #333333;">LastName</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">_employees</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Remember the <strong>Employees</strong> property code we&#8217;ve copied from the deleted App.cs? Now it&#8217;s the time to use the code. In this ViewModel, we simply populate the list of employees to the <strong>SourceItems</strong> property of the <strong>EmployeeListViewModel </strong>and set the initial <strong>Title</strong> for the <strong>EmployeeListViewModel</strong>. Next, let&#8217;s prepare the <strong>EmployeeListFragment</strong>. Create a new Crosslight Android Material List Fragment inside <strong>XamarinFormsSample.Android/Fragments</strong> folder and give it a name of <strong>EmployeeListFragment</strong>.</p>
<p><img class="alignnone size-full wp-image-7172" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-9.54.55-AM.png" alt="Screen Shot 2016-03-21 at 9.54.55 AM.png" width="1657" height="1241" /></p>
<p>Use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">.</span><span style="color: #333333;">ComponentModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Graphics</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Graphics</span><span style="color: #333333;">.</span><span style="color: #333333;">Drawables</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Fragments</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #c44c57;">EmployeeListBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">RecyclerViewFragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListFragment</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListFragment</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> Gets the layout identifier of list item.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">value</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> The list item layout identifier.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">value</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">int</span><span style="color: #333333;"> </span><span style="color: #333333;">ItemLayoutId</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Layout</span><span style="color: #333333;">.</span><span style="color: #c44c57;">item_layout</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;">To</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">learn</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">more</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">how</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">to</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">configure</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">this</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">template</span><span style="font-style: italic; color: #888888;">,</span><span style="font-style: italic; color: #888888;"> </span><br />
<span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;">see</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">http</span><span style="font-style: italic; color: #888888;">:</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">developer</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">intersoftsolutions</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">com</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">display</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">crosslight</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">Using</span><span style="font-style: italic; color: #888888;">+</span><span style="font-style: italic; color: #888888;">Material</span><span style="font-style: italic; color: #888888;">+</span><span style="font-style: italic; color: #888888;">Recycler</span><span style="font-style: italic; color: #888888;">+</span><span style="font-style: italic; color: #888888;">View</span><span style="font-style: italic; color: #888888;">+Fragment</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ImageLoaderSettings</span><span style="color: #333333;">.</span><span style="color: #333333;">AnimateOnLoad</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Appearance</span><span style="color: #333333;">.</span><span style="color: #333333;">Background</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ColorDrawable</span><span style="color: #333333;">(</span><span style="color: #3364a4;">Color</span><span style="color: #333333;">.</span><span style="color: #333333;">WhiteSmoke</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;">Recycler</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">View</span><span style="font-style: italic; color: #888888;"> configuration</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">InteractionMode</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ListViewInteraction</span><span style="color: #333333;">.</span><span style="color: #333333;">Navigation</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SourceSharedElementIds</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Id</span><span style="color: #333333;">.</span><span style="color: #c44c57;">Icon</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>The list view is pretty simple, it only contains 2 default constructors needed for Fragment initialization, then we provide the item layout to be used by providing the item_layout as ID (which we&#8217;ll create in just a moment), then in the <strong>Initialize</strong> method, we initialized several settings, such as <strong>ImageLoaderSettings</strong> to animate when it loads, then set the Fragment background to the <strong>Color.WhiteSmoke</strong> color. Then we configure the <strong>InteractionMode</strong> of the Fragment to navigate upon item click. Lastly, we specified the shared element transition to transition from the ImageView with id of Icon to the FormFragment (which we&#8217;ll create after the Employee List screen).</p>
<p>Create a new Android layout file inside<strong> XamarinFormsSample.Android/Resources/layout</strong> folder and give it a name of <strong>item_layout</strong>.</p>
<p><img class="alignnone size-full wp-image-7191" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-10.02.27-AM.png" alt="Screen Shot 2016-03-21 at 10.02.27 AM.png" width="1681" height="1310" /></p>
<p>Paste the following code inside the new layout file.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">intersoft</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">crosslight</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">v7</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">CardView</span><span style="color: #3364a4;"> </span><span style="color: #333333;">xmlns:app</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">http</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">schemas</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">com</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">apk</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">res</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">auto</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">xmlns:android</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">http</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">schemas</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">com</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">apk</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">res</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:foreground</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">?</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">attr</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">selectableItemBackground</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginLeft</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">8dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginRight</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">8dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginBottom</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">8dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">app:cardElevation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">2dp</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">RelativeLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">80dp</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ImageView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">72dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">72dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Icon</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_margin</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">4dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center_vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_centerVertical</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LinearLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_toRightOf</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Icon</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center_vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_centerVertical</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:orientation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">vertical</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">TextView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:textAppearance</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">?</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">attr</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">textAppearanceMedium</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">TextLabel</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:ellipsize</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">end</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:singleLine</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">TextView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:textAppearance</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">?</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">attr</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">textAppearanceSmall</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Text2</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:singleLine</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">RelativeLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">intersoft</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">crosslight</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">v7</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">CardView</span><span style="color: #333333;">&gt;</span></span></p>
<p>Here, we&#8217;re going to use the new CardView to be the item layout for our employee list screen. To wrap up this view, we&#8217;re going to create the <strong>EmployeeListBindingProvider</strong> that will bind the data from the <strong>EmployeeListViewModel</strong> to the <strong>EmployeeListFragment</strong>. Create a new folder inside the <strong>XamarinFormsSample</strong> (PCL) project called <strong>BindingProviders</strong> and place it inside the newly created folder.</p>
<p><img class="alignnone size-full wp-image-7200" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-10.06.09-AM.png" alt="Screen Shot 2016-03-21 at 10.06.09 AM.png" width="1643" height="1295" /></p>
<p>Use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListBindingProvider</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingProvider</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListBindingProvider</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #3364a4;">ItemBindingDescription</span><span style="color: #333333;"> </span><span style="color: #333333;">itemBinding</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemBindingDescription</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                DisplayMemberPath </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">DisplayName</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                DetailMemberPath </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Twitter</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                ImageMemberPath </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">ImageUri</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">TableView</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">ItemsSourceProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Items</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">TableView</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">ItemTemplateBindingProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">itemBinding</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">TableView</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">SelectedItemProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">SelectedItem</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingMode</span><span style="color: #333333;">.</span><span style="color: #333333;">TwoWay</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">this</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">AddBinding</span><span style="font-style: italic; color: #888888;">(</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">TableView</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">,</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">BindableProperties</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">DetailNavigationTargetProperty</span><span style="font-style: italic; color: #888888;">,</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">new</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">NavigationTarget</span><span style="font-style: italic; color: #888888;">(</span><span style="font-style: italic; color: #888888;">typeof</span><span style="font-style: italic; color: #888888;">(</span><span style="font-style: italic; color: #888888;">EmployeeEditorViewModel</span><span style="font-style: italic; color: #888888;">)</span><span style="font-style: italic; color: #888888;">,</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">NavigationMode</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Push</span><span style="font-style: italic; color: #888888;">)</span><span style="font-style: italic; color: #888888;">,</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">true</span><span style="font-style: italic; color: #888888;">)</span><span style="font-style: italic; color: #888888;">;</span><br />
<span style="color: #333333;">            </span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>In the <strong>EmployeeListBindingProvider</strong>, we did several things:</p>
<ul>
<li>Bound the <strong>ItemsSource</strong> for the <strong>RecyclerView</strong> with the Items property from the <strong>ViewModel</strong>.</li>
<li>Bound the <strong>ItemTemplateBinding</strong> for the RecyclerView to display the specified <strong>ItemBindingDescription</strong>.</li>
<li>Bound the <strong>SelectedItem</strong> of the <strong>RecyclerView</strong> to the <strong>SelectedItem</strong> property in the <strong>ViewModel</strong>.</li>
<li>Bound the <strong>DetailNavigationTarget</strong> of the <strong>RecyclerView</strong> to use which <strong>ViewModel</strong> when navigation is performed, and what mode of the navigation is used. (which is commented for now, for the sake compilation purposes).</li>
</ul>
<p>Let&#8217;s build and run this project to see how it looks like.</p>
<p><img class="alignnone size-full wp-image-7215" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/android-employee-list.png" alt="android-employee-list.png" width="400" height="1136" /></p>
<p>Phew. We&#8217;re almost there. For Android, we only have 1 screen left, which is the editor view. Let&#8217;s proceed.</p>
<h1>Preparing the Employee Editor Screen</h1>
<p>In this section, we&#8217;re going to use the Crosslight Form Builder capabilities to display our form. Begin by creating a new folder inside the <strong>XamarinFormsSample</strong> (PCL) and call it <strong>Forms</strong>. Inside the folder, create a new empty class and name it <strong>Employee.FormMetadata.cs</strong>.</p>
<p><img class="alignnone size-full wp-image-7222" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/forms.png" alt="forms.png" width="250" height="340" /></p>
<p>Replace the contents of the file with the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Forms</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">FormMetadataType</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">.</span><span style="color: #3364a4;">FormMetadata</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">partial</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Form</span><span style="color: #333333;">(</span><span style="color: #333333;">Title </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">{</span><span style="color: #f57d00;">FormState</span><span style="color: #f57d00;">}</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">Employee</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FormMetadata</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Section</span><span style="color: #333333;">]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ImageSection</span><span style="color: #333333;"> </span><span style="color: #333333;">ImageSection</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Section</span><span style="color: #333333;">]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #3364a4;">GeneralSection</span><span style="color: #333333;"> </span><span style="color: #333333;">GeneralSection</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Section</span><span style="color: #333333;">]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ButtonSection</span><span style="color: #333333;"> </span><span style="color: #333333;">ButtonSection</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ImageSection</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Editor</span><span style="color: #333333;">(</span><span style="color: #333333;">EditorType</span><span style="color: #333333;">.</span><span style="color: #333333;">Image</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Layout</span><span style="color: #333333;">(</span><span style="color: #333333;">Style </span><span style="color: #333333;">=</span><span style="color: #333333;"> LayoutStyle</span><span style="color: #333333;">.</span><span style="color: #333333;">DetailOnly</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Image</span><span style="color: #333333;">(</span><span style="color: #333333;">Height </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">250</span><span style="color: #333333;">,</span><span style="color: #333333;"> HorizontalAlignment </span><span style="color: #333333;">=</span><span style="color: #333333;"> ControlHorizontalAlignment</span><span style="color: #333333;">.</span><span style="color: #333333;">Center</span><span style="color: #333333;">,</span><span style="color: #333333;"> ScaleMode </span><span style="color: #333333;">=</span><span style="color: #333333;"> ImageScaleMode</span><span style="color: #333333;">.</span><span style="color: #333333;">ScaleAspectFit</span><span style="color: #333333;">,</span><span style="color: #333333;"> Padding </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">6</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Editable</span><span style="color: #333333;">(</span><span style="color: #009695;">false</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">ImageUri</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">GeneralSection</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">StringInput</span><span style="color: #333333;">(</span><span style="color: #333333;">Placeholder </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">First</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">Name</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Display</span><span style="color: #333333;">(</span><span style="color: #333333;">Caption </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">First</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">Name</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">FirstName</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">StringInput</span><span style="color: #333333;">(</span><span style="color: #333333;">Placeholder </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Last</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">Name</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Display</span><span style="color: #333333;">(</span><span style="color: #333333;">Caption </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Last</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">Name</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">LastName</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">StringInput</span><span style="color: #333333;">(</span><span style="color: #333333;">Placeholder </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Twitter</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Display</span><span style="color: #333333;">(</span><span style="color: #333333;">Caption </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Twitter</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">static</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">Twitter</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ButtonSection</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Editor</span><span style="color: #333333;">(</span><span style="color: #333333;">EditorType</span><span style="color: #333333;">.</span><span style="color: #333333;">Button</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Binding</span><span style="color: #333333;">(</span><span style="color: #333333;">Path </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">DeleteCommand</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> SourceType </span><span style="color: #333333;">=</span><span style="color: #333333;"> BindingSourceType</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModel</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">[</span><span style="color: #333333;">Button</span><span style="color: #333333;">(</span><span style="color: #333333;">Title </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Delete</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> TextColor </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">#</span><span style="color: #f57d00;">FFFF0000</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> Style </span><span style="color: #333333;">=</span><span style="color: #333333;"> ButtonStyle</span><span style="color: #333333;">.</span><span style="color: #333333;">Simple</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">ShowMessageButton</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Let&#8217;s take this code from the top. We&#8217;ve created a <strong>partial</strong> class from the <strong>Employee</strong> model. Form Builder is all about attributes, whether it&#8217;s in the class level or property level. In the class definition, the <strong>FormAttribute</strong> is used to indicate that this is a Crosslight Form Builder metadata, and which class used as the real form metadata.</p>
<p>In this example, the inner <strong>FormMetadata</strong> class is used. Then, we have 3 sections, which will be inner classes as well, the three sections are: <strong>ImageSection</strong>, <strong>GeneralSection</strong> and <strong>ButtonSection</strong>. Then in each section, we define each properties that will be rendered for the form. It is highly recommended to use the same name as the original properties contained in the Model, or else, you would have to specify the <strong>BindingAttribute</strong> that will be used for the property, as shown in the last property in the <strong>ButtonSection</strong>.</p>
<p>Now that we&#8217;ve prepared the Form Metadata, let&#8217;s proceed by creating the FormFragment. Create a new <strong>Crosslight Android Material Form Fragment</strong> inside the <strong>Fragments</strong> folder and call it <strong>EmployeeFormFragment</strong>.</p>
<p><img class="alignnone size-full wp-image-7228" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-10.42.08-AM1.png" alt="Screen Shot 2016-03-21 at 10.42.08 AM.png" width="1689" height="1305" /></p>
<p>&nbsp;</p>
<p>Replace the contents of the file with the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Fragments</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeFormFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FormFragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EmployeeEditorViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeFormFragment</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeFormFragment</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">Overrides</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">of</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">FormFragment</span><span style="color: #c12dac;">&lt;</span><span style="color: #c12dac;">EmployeeEditorViewModel</span><span style="color: #c12dac;">&gt;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SharedImageIndex</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">0</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBarItem</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BarItem</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">SaveButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CommandItemType</span><span style="color: #333333;">.</span><span style="color: #333333;">Done</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>As you can see, the <strong>EmployeeFormFragment</strong> contains nothing except for the 2 default constructors, and very minimal definition for the overridden <strong>Initialize</strong> method. Here, we specified the SharedImageIndex which will be needed for shared element transition and also added a <strong>BarItem</strong> with the ID <strong>SaveButton</strong>. Next, we&#8217;ll prepare the ViewModel for this Form Builder. Create a new <strong>Crosslight Editor View Model</strong> inside the <strong>XamarinFormsSample/ViewModels</strong> folder and call it <strong>EmployeeEditorViewModel</strong>.</p>
<p><img class="alignnone size-full wp-image-7229" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-10.47.41-AM.png" alt="Screen Shot 2016-03-21 at 10.47.41 AM.png" width="1711" height="1307" /></p>
<p>Then use the following code for the file.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Input</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Model</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeEditorViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditorViewModelBase</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeEditorViewModel</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">DeleteCommand</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DelegateCommand</span><span style="color: #333333;">(</span><span style="color: #333333;">ExecuteDelete</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DelegateCommand</span><span style="color: #333333;"> </span><span style="color: #333333;">DeleteCommand</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">get</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #009695;">set</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">ParentViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">get</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #009695;">set</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteDelete</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ParentViewModel</span><span style="color: #333333;">.</span><span style="color: #333333;">SourceItems</span><span style="color: #333333;">.</span><span style="color: #333333;">Remove</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Item</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><span style="color: #333333;">   </span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">NavigationService</span><span style="color: #333333;">.</span><span style="color: #333333;">Close</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">Overrides</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">of</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">EditorViewModelBase</span><span style="color: #c12dac;">&lt;</span><span style="color: #c12dac;">Employee</span><span style="color: #c12dac;">&gt;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteSave</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">ExecuteSave</span><span style="color: #333333;">(</span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;">Needed</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">in</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">iOS</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">to</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">notify</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">that</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">item</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">has</span><span style="font-style: italic; color: #888888;"> changed</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnDataChanged</span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Item</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Navigated</span><span style="color: #333333;">(</span><span style="color: #333333;">Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #3364a4;">NavigatedParameter</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Navigated</span><span style="color: #333333;">(</span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">employeeListViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">.</span><span style="color: #333333;">Sender</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">employeeListViewModel</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ParentViewModel</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">employeeListViewModel</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Item</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">.</span><span style="color: #333333;">Data</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Employee</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>In the <strong>Navigated</strong> method of the above <strong>ViewModel</strong>, we simply pass the selected item from the previous ViewModel (<strong>EmployeeListViewModel</strong>) to be used as the <strong>Item</strong> for the Form. Here, we also prepared the <strong>Save</strong> and <strong>Delete</strong> methods that will be used for the form.</p>
<p>Lastly, let&#8217;s create the <strong>EmployeeFormBindingProvider</strong> inside the <strong>XamarinFormsSample/BindingProviders</strong> folder. Then use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeFormBindingProvider</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingProvider</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeFormBindingProvider</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">SaveButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">CommandProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">SaveCommand</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Here, we simply bound the BarItem to the <strong>SaveCommand</strong> property in the ViewModel. And before we forgot, uncomment the commented line in the <strong>EmployeeListBindingProvider</strong>. Then build and run your project to see it in action.</p>
<p><img class="alignnone size-full wp-image-7231" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/android-form-fragment.png" alt="android-form-fragment.png" width="400" height="1136" /></p>
<p>When you navigate to the Form Fragment, notice that the shared element transition effect is applied automatically. We&#8217;ve finished the Android app. Now let&#8217;s move on to the iOS project.</p>
<h1>Bootstrapping the iOS Project</h1>
<p>Similar to the Android project, the iOS project also need to be re-bootstrapped since it also comes from Xamarin.Forms. First, change the debug configuration to Debug | iPhone Simulator so you can run the iOS project.</p>
<p><img class="alignnone size-full wp-image-7244" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/debug-iphone.png" alt="debug-iphone.png" width="400" height="628" /></p>
<p>Let&#8217;s remove the unnecessary Xamarin.Forms references in iOS project.</p>
<p><img class="alignnone size-full wp-image-7247" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-forms-ios.png" alt="xamarin-forms-ios.png" width="400" height="582" /></p>
<p>Next, we have to migrate the sample to use the new iOS.Unified API. To do this, select the project, and select <strong>Project</strong>, <strong>Migrate to Xamarin.iOS Unified API</strong>.</p>
<p><img class="alignnone size-full wp-image-7254" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-ios-unified-api.png" alt="xamarin-ios-unified-api.png" width="1518" height="1078" /></p>
<p>Then install Crosslight.iOS using NuGet by running the following command (if you&#8217;re on Mac Xamarin Studio) with the iOS project selected.</p>
<p>Install-Package Intersoft.Crosslight</p>
<p><img class="alignnone size-full wp-image-7259" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/install-ios-crosslight.png" alt="install-ios-crosslight.png" width="1366" height="236" /></p>
<p>Ensure that the packages are installed correctly by inspecting the <strong>References</strong> folder.</p>
<p><img class="alignnone size-full wp-image-7263" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/ios-references.png" alt="ios-references.png" width="250" height="258" /></p>
<p>Next, open <strong>AppDelegate.cs</strong> and replace the contents as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> IntersoftCore </span><span style="color: #333333;">=</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Foundation</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> UIKit</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">The</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">UIApplicationDelegate</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">for</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">application</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">This</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">class</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">is</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">responsible</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">for</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">launching</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">User</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Interface</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">of</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">application</span><span style="font-style: italic; color: #888888;">,</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">as</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">well</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">as</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">listening</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">(</span><span style="font-style: italic; color: #888888;">and</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">optionally</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">responding</span><span style="font-style: italic; color: #888888;">)</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">to</span><span style="font-style: italic; color: #888888;"> </span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">application</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">events</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">from</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">iOS</span><span style="font-style: italic; color: #888888;">.</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Register</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">AppDelegate</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppDelegate</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> IntersoftCore</span><span style="color: #333333;">.</span><span style="color: #3364a4;">UIApplicationDelegate</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Wraps the content view controller into the root view controller.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">contentViewController</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">Content view controller.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The root view controller.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UIViewController</span><span style="color: #333333;"> </span><span style="color: #333333;">WrapRootViewController</span><span style="color: #333333;">(</span><span style="color: #3364a4;">UIViewController</span><span style="color: #333333;"> </span><span style="color: #333333;">contentViewController</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">contentViewController</span><span style="color: #333333;"> </span><span style="color: #009695;">is</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UISplitViewController</span><span style="color: #333333;"> || </span><span style="color: #333333;">contentViewController</span><span style="color: #333333;"> </span><span style="color: #009695;">is</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UITabBarController</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #333333;">contentViewController</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UINavigationController</span><span style="color: #333333;">(</span><span style="color: #333333;">contentViewController</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This is needed for Crosslight.iOS to create the navigation controllers automatically when performing navigation between ViewModels. Then, create a new folder at the root of the iOS project called <strong>Infrastructure</strong>, and create a new empty class with the name of <strong>AppInitializer.cs</strong>.</p>
<p><img class="alignnone size-full wp-image-7269" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/xamarin-ios-infrastructure.png" alt="xamarin-ios-infrastructure.png" width="250" height="536" /></p>
<p>Replace the contents of the file as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Infrastructure</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     iOS&#8217;s application initializer.</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">seealso</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">cref</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">Intersoft</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">Crosslight</span><span style="font-style: italic; color: #888888;">.</span><span style="font-style: italic; color: #888888;">IApplicationInitializer</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">sealed</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppInitializer</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IApplicationInitializer</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">Implementation</span><span style="color: #c12dac;"> </span><span style="color: #c12dac;">of</span><span style="color: #c12dac;"> IApplicationInitializer</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Gets the application service based on the current context.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">context</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The context of the application.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     The application service.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">returns</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IApplicationService</span><span style="color: #333333;"> </span><span style="color: #333333;">GetApplicationService</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationContext</span><span style="color: #333333;"> </span><span style="color: #333333;">context</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CrosslightAppAppService</span><span style="color: #333333;">(</span><span style="color: #333333;">context</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes and prepares the application for launch.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">appHost</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The application host.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">InitializeApplication</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationHost</span><span style="color: #333333;"> </span><span style="color: #333333;">appHost</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes the components required for the application to run properly.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">appHost</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The application host.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">InitializeComponents</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationHost</span><span style="color: #333333;"> </span><span style="color: #333333;">appHost</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;">     Initializes the services for the application to start properly.</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">summary</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="font-style: italic; color: #888888;">///</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">name</span><span style="font-style: italic; color: #888888;">=</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">appHost</span><span style="font-style: italic; color: #888888;">&#8220;</span><span style="font-style: italic; color: #888888;">&gt;</span><span style="font-style: italic; color: #888888;">The application host.</span><span style="font-style: italic; color: #888888;">&lt;</span><span style="font-style: italic; color: #888888;">/</span><span style="font-style: italic; color: #888888;">param</span><span style="font-style: italic; color: #888888;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">InitializeServices</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IApplicationHost</span><span style="color: #333333;"> </span><span style="color: #333333;">appHost</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Similar to Android, this is the application initializer for iOS, where you can register custom view components, services, iOS views, and more. However, in this tutorial, we won&#8217;t register any additional services. Now, if you try to build the project, you should be able to build it successfully. Great, let&#8217;s create the ViewControllers for iOS. Start by creating a new folder called <strong>ViewControllers. </strong>Then create a new ViewController called <strong>LoginViewController</strong>.</p>
<p><img class="alignnone size-full wp-image-7288" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-2.12.24-PM.png" alt="Screen Shot 2016-03-21 at 2.12.24 PM.png" width="1663" height="1301" /></p>
<p>Your current folder structure should look like this.</p>
<p><img class="alignnone size-medium wp-image-7290" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/LoginViewController-186x300.png" alt="LoginViewController" width="186" height="300" /></p>
<p>Replace the contents as follows.</p>
<p><span style="font-family: Menlo;"> <span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Drawing</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Foundation</span><span style="color: #333333;">;</span></span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Register</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">EmployeeFormViewController</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeFormViewController</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UIFormViewController</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EmployeeEditorViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><span style="color: #333333;">   </span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>As you can see, in the <strong>LoginViewController</strong> contains nothing. Before you can run the project, open up the iOS project options by double-clicking on the iOS project, then in the <strong>iOS Build</strong> menu, ensure that the Supported architectures for the <strong>Debug | iPhone Simulator</strong> configuration supports the <strong>64-bit</strong> emulator. <img class="alignnone size-full wp-image-7316" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-2.45.44-PM.png" alt="Screen Shot 2016-03-21 at 2.45.44 PM.png" width="1907" height="1507" /></p>
<p>Then try to run the project to the iOS Simulator. You should get the following result.</p>
<p><img class="alignnone size-full wp-image-7317" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/iOS-Login.png" alt="iOS-Login.png" width="400" height="1136" /></p>
<p>Okay, seems our login screen has worked well. Now let&#8217;s move on to creating the rest of the views. This will be a breeze. Proceed by creating a new <strong>Table ViewController</strong> inside the <strong>ViewControllers</strong> folder. Name it <strong>EmployeeListViewController</strong>.</p>
<p><img class="alignnone size-full wp-image-7318" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-3.24.23-PM.png" alt="Screen Shot 2016-03-21 at 3.24.23 PM.png" width="1713" height="1309" /></p>
<p>Then use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">BindingProviders</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Foundation</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Drawing</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Register</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">EmployeeListViewController</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">EmployeeListBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EmployeeListViewController</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">UITableViewController</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">EmployeeListViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ImageSettings</span><span style="color: #333333;"> </span><span style="color: #333333;">CellImageSettings</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ImageSettings</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    ImageSize </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">SizeF</span><span style="color: #333333;">(</span><span style="color: #f57d00;">36</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">36</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #3364a4;">TableViewCellStyle</span><span style="color: #333333;"> </span><span style="color: #333333;">CellStyle</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #3364a4;">TableViewCellStyle</span><span style="color: #333333;">.</span><span style="color: #333333;">Subtitle</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BasicImageLoaderSettings</span><span style="color: #333333;"> </span><span style="color: #333333;">ImageLoaderSettings</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BasicImageLoaderSettings</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    AnimateOnLoad </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    CacheExpirationPolicy </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CacheExpirationPolicy</span><span style="color: #333333;">.</span><span style="color: #333333;">AutoDetect</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #3364a4;">TableViewInteraction</span><span style="color: #333333;"> </span><span style="color: #333333;">InteractionMode</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #3364a4;">TableViewInteraction</span><span style="color: #333333;">.</span><span style="color: #333333;">Navigation</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Since this ViewController does not require any initialization from the Storyboard, then the constructor is not needed. Here, we&#8217;ve configured several properties, such as the <strong>CellImageSettings</strong>, <strong>CellStyle</strong>, <strong>ImageLoaderSettings</strong> and <strong>InteractionMode</strong>. Let&#8217;s create our last ViewController, which is the EmployeeFormViewController.</p>
<p><img class="alignnone size-full wp-image-7320" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-21-at-3.28.42-PM.png" alt="Screen Shot 2016-03-21 at 3.28.42 PM.png" width="1686" height="1301" /></p>
<p>Then use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">Core</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">.</span><span style="color: #333333;">Drawing</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Foundation</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> XamarinFormsSample</span><span style="color: #333333;">.</span><span style="color: #333333;">iOS</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #333333;">Register</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">EmployeeFormViewController</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> EmployeeFormViewController </span><span style="color: #333333;">:</span><span style="color: #333333;"> UIFormViewController</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">EmployeeEditorViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> DetermineNavigationMode</span><span style="color: #333333;">(</span><span style="color: #333333;">NavigationParameter parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">GetService</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">IApplicationService</span><span style="color: #333333;">&gt;()</span><span style="color: #333333;">.</span><span style="color: #333333;">GetContext</span><span style="color: #333333;">()</span><span style="color: #333333;">.</span><span style="color: #333333;">Device</span><span style="color: #333333;">.</span><span style="color: #333333;">Kind </span><span style="color: #333333;">==</span><span style="color: #333333;"> DeviceKind</span><span style="color: #333333;">.</span><span style="color: #333333;">Tablet</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">     </span><span style="color: #3364a4;">        </span><span style="color: #333333;">   </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Only</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">customize</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">the</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">navigation</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">mode</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">for</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">editing</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">(</span><span style="font-style: italic; color: #888888;">default</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">navigation</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">command</span><span style="font-style: italic; color: #888888;">)</span><br />
<span style="color: #333333;">     </span><span style="color: #3364a4;">           if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">parameter</span><span style="color: #c44c57;">.CommandId ==</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    parameter</span><span style="color: #333333;">.</span><span style="color: #333333;">PreferPopover </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                    parameter</span><span style="color: #333333;">.</span><span style="color: #333333;">EnsureNavigationContext </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>The EmployeeFormViewController is pretty much empty. The DetermineNavigationMode helps to determine whether the app is run from an iPhone or an iPad, and which container should be returned upon navigation. It seems that the iOS app is ready. Let&#8217;s try to give it a run.</p>
<p><img class="alignnone size-full wp-image-7321" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/ios-views.png" alt="ios-views.png" width="1366" height="1136" /></p>
<p>If you notice, our effort to create the iOS app is much smaller compared to the Android version. This is the power of Crosslight. You an easily reuse 100% of the UI logic for iOS and Android platform, allowing developers to accomplish more in less time.</p>
<h1>Samples</h1>
<p>You can obtain the finished sample <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightxamarinformsbuilder/browse" target="_blank">here</a>. Simply restore the NuGet packages and hit Run to run the sample properly. Should have any questions, feel free to leave a comment down below or initiate a <a href="http://www.intersoftsolutions.com/#livechat" target="_blank">live chat</a> session with us directly from our website.</p>
<h1>Wrapping Up</h1>
<p>In this tutorial, you have learnt how to migrate a Xamarin Form app to Crosslight which is pretty straightforward. Leveraging MVVM pattern, you have learnt the Crosslight fundamentals, particularly the <em>binding providers</em>, <em>ViewModels</em>, <em>Form Metadata</em>, and <em>Views</em>.</p>
<p>Along the way, you might be interested in several topics, such as the Form Builder, or working with the Storyboard, nonetheless, I highly recommend you to go through each of these topics to quench your thirst:</p>
<ul>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Building+Rich+Data+Entry+Form" target="_blank">Building Rich Data Entry Form</a>
<ul>
<li>If you&#8217;d like to get started with the Form Builder, I highly recommend you to look at the two-part blogpost series I wrote up: <a href="http://blog.intersoftsolutions.com/2015/11/getting-started-with-crosslight-form-builder/" target="_blank">Getting Started with Crosslight Form Builder</a> and <a href="http://blog.intersoftsolutions.com/2015/11/extending-crosslight-form-builder-2/" target="_blank">Extending Crosslight Form Builder</a>.</li>
</ul>
</li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Working+with+iOS+Universal+Storyboards" target="_blank">Working with iOS Universal Storyboards</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Crosslight+Android+Material+Development" target="_blank">Crosslight Android Material Development</a></li>
</ul>
<p>Don&#8217;t hesitate to explore the child pages on the documentation as well, as it contains more detailed information on each particular subject. Hopefully this tutorial helps you on grasping the concepts used in Crosslight development and accelerate in building gorgeous cross-platform apps, without sacrificing any user experiences along the way.</p>
<p>Till next post,<br />
Nicholas Lie</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2016/03/migrating-from-xamarin-forms-to-crosslight-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating to WebUI Unified Theming</title>
		<link>http://blog.intersoftsolutions.com/2016/03/migrating-to-webui-unified-theming/</link>
		<comments>http://blog.intersoftsolutions.com/2016/03/migrating-to-webui-unified-theming/#comments</comments>
		<pubDate>Tue, 15 Mar 2016 08:42:49 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2016 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Getting Started Guide]]></category>
		<category><![CDATA[WebUI]]></category>
		<category><![CDATA[Unified Theming]]></category>
		<category><![CDATA[WebGrid]]></category>
		<category><![CDATA[WebUI Studio]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=6477</guid>
		<description><![CDATA[We&#8217;ve recently released&#160;our new Unified Theming for WebUI, which will dramatically alter the look and feel of your WebUI-powered apps, giving it a fresh, modern look and feel. But, how will you&#160;be able to take advantage of this new feature? In this post, I&#8217;m going [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/webgrid-final-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="webgrid-final" style="float:right; margin:0 0 10px 10px;" /><p>We&#8217;ve recently released&nbsp;our new Unified Theming for WebUI, which will dramatically alter the look and feel of your WebUI-powered apps, giving it a fresh, modern look and feel. But, how will you&nbsp;be able to take advantage of this new feature? In this post, I&#8217;m going to show you&nbsp;how convert the <a href="http://live.intersoftsolutions.com/cs/WebGrid/Enterprise.aspx?noframe=1&amp;path=/WebGrid/Top%20Features/Rich%20User%20Interface" target="_blank">WebGrid Enterprise sample</a>&nbsp;to use the new WebUI Unified Theming. At the end of this post, you should&nbsp;have&nbsp;the following result.</p>
<p><img class="alignnone size-full wp-image-6488" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/webgrid-unified-theming.png" alt="webgrid-unified-theming.png" width="1958" height="702"></p>
<p>Here&#8217;s a&nbsp;single image of the revamped sample&nbsp;in full Unified Theming glory.</p>
<p><img class="alignnone size-full wp-image-6493" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/webgrid.png" alt="webgrid.png" width="1078" height="702"></p>
<p>Ready to begin?</p>
<h1>What You&#8217;ll Need</h1>
<p>Before you begin, you&#8217;ll need to ensure&nbsp;that you have&nbsp;properly installed Visual Studio 2012 or higher and have installed Premier Studio 2016 (or higher). If not, feel free to&nbsp;perform <a href="http://www.intersoftsolutions.com/RequestTrial" target="_blank">Request Trial</a> from our site to get the latest installer. Or, if you&nbsp;have purchased a subscription, you&nbsp;can easily obtain the latest version of the installer by simply <a href="http://www.intersoftsolutions.com/Account" target="_blank">signing in to your account</a>.</p>
<h1>Let&#8217;s Begin.</h1>
<p>In overview, here&#8217;s what we&#8217;re&nbsp;going to accomplish:</p>
<ul>
<li>Create a&nbsp;new Unified Theming project using the new Project Template.</li>
<li>Import&nbsp;the existing&nbsp;WebGrid&#8217;s Enterprise sample (from the old sample) to the new project.</li>
<li>Remove all style-related&nbsp;attributes.</li>
<li>Convert the sample to use the new Unified Theming.</li>
</ul>
<h1>Create New&nbsp;Unified Theming Project</h1>
<p>Open up Visual Studio and create a new Unified Theming project by selecting <strong>Visual C#</strong>,&nbsp;<strong>Intersoft Solutions</strong>,&nbsp;<strong>ASP.NET</strong>,&nbsp;<strong>Intersoft Unified&nbsp;Empty Web Application</strong>, as&nbsp;shown in the illustration below. Let&#8217;s call this project <strong>FirstUnifiedTheming</strong> and hit OK.</p>
<p><img class="alignnone size-full wp-image-6519" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/new-project.png" alt="new-project.png" width="1614" height="1136"></p>
<p>Let&#8217;s import the Enterprise.aspx from the&nbsp;old sample to&nbsp;our project. To do this,&nbsp;right-click on&nbsp;your solution, then choose <strong>Add</strong>,&nbsp;<strong>Existing Item</strong>.</p>
<p><img class="alignnone size-full wp-image-6526" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-existing-item.png" alt="add-existing-item.png" width="1450" height="603"></p>
<p>Navigate to&nbsp;<strong>C:\Program Files (x86)\Intersoft Solutions\Samples\For ASP.NET\ISNet.WebUI.Samples\cs\WebGrid</strong> and&nbsp;select <strong>Enterprise.aspx</strong>. Just select the .aspx file and its code-behind will be automatically added as well.</p>
<p><img class="alignnone size-full wp-image-6531" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/enterprise.png" alt="enterprise.png" width="1538" height="1034"></p>
<p>Now that you have&nbsp;the file imported,&nbsp;we need to convert it so that it will be compatible with Web Application.&nbsp;Select the file, then go to <strong>Project</strong>, then choose <strong>Convert to Web Application</strong> as shown below.</p>
<p><img class="alignnone size-full wp-image-6539" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/convert-to-web-application.png" alt="convert-to-web-application.png" width="1976" height="716"></p>
<h1>Removing Unnecessary Styles</h1>
<p>By default,&nbsp;the&nbsp;Unified&nbsp;Theming project template provides a handy&nbsp;<strong>App.master</strong> file contained in the <strong>Master</strong> folder. So, we can use this master file for our&nbsp;imported sample. Change the&nbsp;<strong>MasterPageFile</strong>&nbsp;for the <strong>Enterprise.aspx</strong> from <strong>./DefaultMaster.master</strong> to <strong>~/Master/App.master.</strong></p>
<p><img class="alignnone size-full wp-image-6549" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/master-page-file.png" alt="master-page-file.png" width="1088" height="155"></p>
<p>Next, search for this file that contains any &#8220;style&#8221; attributes. To do this, press <strong>Ctrl+F</strong> on your keyboard and search for &#8220;<strong>style</strong>&#8221; (without the quotes).</p>
<p>Here&nbsp;are the list of attributes / elements that you have&nbsp;to remove within this file:</p>
<ul>
<li>
<p class="p1"><strong>UseDefaultStyle<span class="s1">=&#8221;True&#8221;</span></strong></p>
</li>
<li>
<p class="p1"><strong>DefaultStyleMode<span class="s1">=&#8221;Elegant&#8221;</span></strong></p>
</li>
<li>
<p class="p1"><strong><span class="s1">&lt;</span><span class="s2">CellStyle</span> HorizontalAlign<span class="s1">=&#8221;Right&#8221;&gt;</span><span class="s1">&lt;/</span><span class="s2">CellStyle</span><span class="s1">&gt;</span></strong></p>
</li>
<li><strong><span class="s1">&lt;</span><span class="s2">CellStyle</span> HorizontalAlign<span class="s1">=&#8221;Center&#8221;&gt;</span><span class="s1">&lt;/</span><span class="s2">CellStyle</span><span class="s1">&gt;</span></strong></li>
</ul>
<p>Note that these&nbsp;are the&nbsp;attributes contained in this file. In your existing project there might&nbsp;be more &#8220;style-related&#8221; attributes that you need to remove.</p>
<p>Next, let&#8217;s fix the&nbsp;code-behind so that&nbsp;this project is compile-able. To do this, open <strong>Enterprise.aspx.cs</strong>, and delete this line.</p>
<p class="p1"><strong><span class="s1">using</span> <span class="s2">Intersoft</span>.SampleFramework.V2009;</strong></p>
<p class="p1">Also remove, the three methods: <strong>WebGrid1_AddRow, WebGrid1_UpdateRow, WebGrid1_DeleteRow</strong>. Then, in <strong>Enterprise.aspx</strong>, remove this line.</p>
<p class="p1"><img class="alignnone size-full wp-image-6716" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/delete-enterprise.png" alt="delete-enterprise.png" width="1823" height="1004"></p>
<p>Since this is a <strong>Web Application</strong> project, not a&nbsp;<strong>Web Site</strong> project, you&#8217;ll need to rebuild it once before you can&nbsp;preview the result in the browser. To rebuild the project, right-click on the project/solution, and hit <strong>Rebuild</strong>.</p>
<p><img class="alignnone size-full wp-image-6587" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/rebuild.png" alt="rebuild.png" width="1278" height="379"></p>
<p>After the rebuild process is done, let&#8217;s try viewing this project in the browser. Right-click on the <strong>Enterprise.aspx</strong> file and choose <strong>View in Browser</strong>.</p>
<p><img class="alignnone size-full wp-image-6591" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/view-in-browser.png" alt="view-in-browser.png" width="1042" height="519"></p>
<p>When you run the project, you&#8217;ll get the following error.</p>
<p><img class="alignnone size-full wp-image-6595" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/isdatasource-error.png" alt="isdatasource-error.png" width="1784" height="1136"></p>
<p>This indicates that the WebGrid was unable to connect with the data source. Let&#8217;s resolve this by <strong>adding the necessary database</strong> file and modifying the <strong>Web.config</strong>&#8216;s connection string.</p>
<h1>Adding the Database</h1>
<p>To make our project&#8217;s file organization neat and less cluttered, let&#8217;s create a new folder called&nbsp;<strong>Common</strong>&nbsp;at the root of the project. Right-click on the project and select <strong>Add</strong>, <strong>New Folder</strong>.</p>
<p><img class="alignnone size-full wp-image-6602" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-folder.png" alt="add-folder.png" width="1457" height="704"></p>
<p>Give it a name of <strong>Common</strong>. Let&#8217;s add the database file used for the project. Right-click on the newly-created <strong>Common</strong> folder and choose <strong>Add</strong>, <strong>Existing Item</strong>.</p>
<p><img class="alignnone size-full wp-image-6606" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-existing-database.png" alt="add-existing-database.png" width="1384" height="436"></p>
<p>Choose the file named <strong>dsEnterprise.xsd</strong> contained in the&nbsp;<strong>C:\Program Files (x86)\Intersoft Solutions\Samples\For ASP.NET\ISNet.WebUI.Samples\cs\WebGrid\App_Code</strong>.</p>
<p><img class="alignnone size-full wp-image-6619" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-dsenterprise.png" alt="add-dsenterprise.png" width="1538" height="1035"></p>
<p>Repeat the process for <strong>AppData</strong> folder. Right-click the AppData folder, choose <strong>Add</strong>, <strong>Existing Item</strong>. Then choose&nbsp;<strong>Northwind.mdb</strong>&nbsp;file contained in&nbsp;<strong>C:\Program Files (x86)\Intersoft Solutions\Samples\For ASP.NET\ISNet.WebUI.Samples\cs\WebGrid\App_Data</strong>.</p>
<p><img class="alignnone size-full wp-image-6610" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-northwind.png" alt="add-northwind.png" width="1538" height="1035"></p>
<p>Next, we need to modify the <strong>SchemaType</strong> and <strong>TypeName</strong> of <strong>ISDataSource</strong> so that it will point to the correct&nbsp;database file. To do this, open the <strong>Enterprise.aspx</strong> file and&nbsp;perform a&nbsp;Replace&nbsp;All for the following string:&nbsp;<strong>SchemaName=&#8221;dsEnterprise&nbsp;</strong>(the unclosed quotes are intentional) to&nbsp;<strong>SchemaName=&#8221;FirstUnifiedTheming.Common.dsEnterprise </strong>(again, the unclosed quotes are intentional).</p>
<p>Repeat the process&nbsp;one more time for the <strong>TypeName</strong>. Search for&nbsp;<strong>TypeName=&#8221;dsEnterprise&nbsp;</strong>and replace it with&nbsp;<strong>TypeName=&#8221;FirstUnifiedTheming.Common.dsEnterprise</strong>. Save the file.</p>
<p>Lastly, let&#8217;s add a connection string in the <strong>Web.config</strong> file for this&nbsp;a new connection the Northwind database. Open up Web.config and add the following connection string to the <strong>ConnectionStrings</strong> node:</p>
<p class="p1">&lt;<span class="s1">add</span> <span class="s2">name</span>=<span class="s3">&#8220;</span>NorthWindConnectionString<span class="s3">&#8220;</span> <span class="s2">connectionString</span>=<span class="s3">&#8220;</span>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\NorthWind.mdb;Persist Security Info=True<span class="s3">&#8220;</span> <span class="s2">providerName</span>=<span class="s3">&#8220;</span>System.Data.OleDb<span class="s3">&#8220;</span>/&gt;</p>
<p class="p1"><img class="alignnone size-full wp-image-6638" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/connection-string.png" alt="connection-string.png" width="1803" height="511"></p>
<h1 class="p1">You&#8217;re Almost There.</h1>
<p>We&#8217;ve&nbsp;roughly finished the migration,&nbsp;but it&#8217;s still&nbsp;missing a few final touches. For now,&nbsp;refresh your browser to see the result.</p>
<p><img class="alignnone size-full wp-image-6644" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/webgrid-initial.png" alt="webgrid-initial.png" width="1784" height="1136"></p>
<p>As you can see, the&nbsp;WebGrid&nbsp;is now applied with Unified Theming. But there are are still two issues left:</p>
<ul>
<li>Adjusting the height of the WebGrid</li>
<li>Providing the missing icons.</li>
</ul>
<p>Let&#8217;s address these issues. To adjust the height of the WebGrid, you can easily do so by modifying the <strong>Height</strong> attribute of the WebGrid inside the <strong>Enterprise.aspx</strong> file. Give it a good value, perhaps <strong>90%</strong>.</p>
<p><img class="alignnone size-full wp-image-6651" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/webgrid-height.png" alt="webgrid-height.png" width="1596" height="475"></p>
<p>We also need to modify the height of the parent container to 100%. To do this, open up <strong>App.master</strong> inside the&nbsp;<strong>Master</strong> folder and add&nbsp;inline-style for the&nbsp;parent container with height&nbsp;set to 100%.</p>
<p><img class="alignnone size-full wp-image-6680" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/app-master-height.png" alt="app-master-height.png" width="1082" height="881"></p>
<p>Next, let&#8217;s provide the missing image icons. To do this, right click on the <strong>Assets</strong> folder and select <strong>Add</strong>, <strong>New Folder</strong>.</p>
<p><img class="alignnone size-full wp-image-6653" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/add-images-folder.png" alt="add-images-folder.png" width="1501" height="559"></p>
<p>Give it a name of <strong>images</strong>. Add the following&nbsp;images from this folder <strong>C:\Program Files (x86)\Intersoft Solutions\Samples\For ASP.NET\WebUI.Unified.Samples\assets\images</strong>:</p>
<ul>
<li><strong>Customer.svg</strong></li>
<li><strong>order-detail.svg</strong> (rename this file to&nbsp;<strong>order-details.svg</strong>)</li>
<li><strong>orders.svg</strong></li>
<li><strong>shipvia1.svg</strong></li>
<li><strong>shipvia2.svg</strong></li>
<li><strong>shipvia3.svg</strong></li>
</ul>
<p>You should have the following images as follows.</p>
<p><img class="alignnone size-full wp-image-6662" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/images.png" alt="images.png" width="250" height="250"></p>
<p>Lastly,&nbsp;perform a Find and Replace for the following string inside the <strong>Enterprise.aspx</strong> file. Replace <strong>./images</strong> with<strong> ~/assets/images</strong>.</p>
<p><img class="alignnone size-full wp-image-6670" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/find-and-replace-assets.png" alt="find-and-replace-assets.png" width="250" height="222"></p>
<p>Then, another Find and Replace for <strong>.gif</strong> to <strong>.svg</strong>. Save the file, rebuild the project and refresh your browser.</p>
<p><img class="alignnone size-full wp-image-6685" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/webgrid-final.png" alt="webgrid-final.png" width="1784" height="1136"></p>
<p>We&#8217;ve successfully set the&nbsp;WebGrid height to fill 90% of the parent container, in which the parent container has been set to 100% height, as well as providing the correct SVG icons for the WebGrid.</p>
<p>One&nbsp;cool thing about&nbsp;the SVG icons are they&#8217;re actually vector icons (SVG is a short form of Scalable Vector Graphics), which will retain its crispiness and hi-res colors when&nbsp;viewed in any devices with varying screens resolutions. To do this, try bumping up the zoom level to 400% or higher.</p>
<p><img class="alignnone size-full wp-image-6691" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/zoom.png" alt="zoom.png" width="1784" height="1136"></p>
<h1>Conclusion</h1>
<p>As you can see, adopting the Unified Theme in your project is quite simple and easy. To learn more about Unified Theming, I highly recommend you to&nbsp;explore the documentation about <a href="http://developer.intersoftsolutions.com/display/WebUI/Unified+Theming" target="_blank">Unified Theming</a>. You can find the link to the finished sample <a href="http://developer.intersoftsolutions.com/download/attachments/24281754/FirstUnifiedTheming.zip?api=v2" target="_blank">here</a>.</p>
<p>In this post, we&#8217;ve learned how to&nbsp;create a&nbsp;Unified Theme project in the&nbsp;shortest and fastest manner using the project templates. In smaller projects, this approach is feasible, but not for larger projects. If you wish to focus solely on migrating your project to Unified Theming, you can&nbsp;follow this documentation: <a href="http://developer.intersoftsolutions.com/display/WebUI/Applying+Unified+Modern+Theme+in+WebUI+Application" target="_blank">Applying Unified Modern Theme in WebUI Application</a>.</p>
<p>You can also find&nbsp;local working samples once you&#8217;ve installed Premier Studio 2016 on your computer. To get started quickly with the local samples, please read my previous&nbsp;<a href="http://blog.intersoftsolutions.com/2016/03/the-all-new-webui-experience-it-yourself/" target="_blank">blog post</a>.</p>
<p>Should you have any questions, feel free to initiate a <a href="http://www.intersoftsolutions.com/#livechat" target="_blank">live chat session with us</a> and our team will get back to you as fast as we can.</p>
<p>Till next post,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2016/03/migrating-to-webui-unified-theming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating to Crosslight Android Material</title>
		<link>http://blog.intersoftsolutions.com/2016/03/migrating-to-crosslight-android-material/</link>
		<comments>http://blog.intersoftsolutions.com/2016/03/migrating-to-crosslight-android-material/#comments</comments>
		<pubDate>Mon, 14 Mar 2016 11:05:52 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2016 R1]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Getting Started Guide]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Material]]></category>
		<category><![CDATA[Crosslight 5]]></category>
		<category><![CDATA[Material Design]]></category>
		<category><![CDATA[Mobile Studio 2016]]></category>
		<category><![CDATA[Premier Studio 2016]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=5970</guid>
		<description><![CDATA[In this post, I&#8217;m going to guide you how to migrate your existing Crosslight Android apps to adopt Material Design with the new Crosslight Android Material Library. I&#8217;m going to use the Inventory Tracker sample contained in the old samples repository and convert the project to use the [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/before-and-after-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="before-and-after" style="float:right; margin:0 0 10px 10px;" /><p>In this post, I&#8217;m going to guide you how to migrate your existing Crosslight Android apps to adopt Material Design with the new Crosslight Android Material Library. I&#8217;m going to use the Inventory Tracker sample contained in the old samples repository and convert the project to use the new Android Material. You can get the old sample <a href="http://git.intersoftpt.com/projects/CROS/repos/samples/browse/MyInventory" target="_blank">here</a>. This tutorial should work with Visual Studio as well. However, I&#8217;m using Xamarin Studio on Mac as it is my development preferences.</p>
<p>At the end of the post, you would be able to achieve the result such as shown in the right image below.</p>
<p><img class="alignnone size-full wp-image-6437" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/before-and-after.png" alt="before-and-after.png" width="1181" height="990" /></p>
<h1>Running the Old Sample</h1>
<p>Should you encounter this error when running the old sample:<img class="alignnone size-full wp-image-6034" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-9.03.01-AM.png" alt="Screen Shot 2016-03-11 at 9.03.01 AM.png" width="1441" height="1236" /></p>
<p class="p1"><span class="s1">All you need to do is install the <strong>Crosslight.Xamarin.Android.Support.v4 </strong>NuGet package onto the <strong>MyInventory.Android.Fragments</strong> project.</span></p>
<p class="p1"><img class="alignnone size-full wp-image-6038" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/crosslight-xamarin-android-support-v4.png" alt="crosslight-xamarin-android-support-v4.png" width="1368" height="442" /></p>
<p class="p1">Consult this documentation should you have difficulties in installing the NuGet package: <a href="http://developer.intersoftsolutions.com/display/crosslight/Introduction+to+Crosslight+NuGet+Packages" target="_blank">Introduction to Crosslight NuGet Packages</a>. If everything is okay, you should be able to run the old sample properly.</p>
<p class="p1"><img class="alignnone size-full wp-image-6046" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/my-inventory-old.png" alt="my-inventory-old.png" width="400" height="840" /></p>
<h1 class="p1">Preparing the Project</h1>
<p>Now we&#8217;re ready to convert this project to use the new Crosslight Android Material library. First, let&#8217;s copy the <strong>MyInventory.Android.Fragments</strong> folder and give it a name of <strong>MyInventory.Android.Fragments.Material</strong>.</p>
<p><img class="alignnone size-full wp-image-6052" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-9.34.20-AM.png" alt="Screen Shot 2016-03-11 at 9.34.20 AM.png" width="1832" height="1170" /></p>
<p>Rename the .csproj file to <strong>MyInventory.Android.Fragments.Material.csproj</strong>.</p>
<p><img class="alignnone size-full wp-image-6054" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-9.38.00-AM.png" alt="Screen Shot 2016-03-11 at 9.38.00 AM.png" width="1832" height="1170" /></p>
<p>Open the .csproj file and edit the <strong>ProjectGuid</strong>, generate a new Guid somewhere or simply change any letter from the existing GUID.</p>
<p><img class="alignnone size-full wp-image-6115" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-10.43.52-AM.png" alt="Screen Shot 2016-03-11 at 10.43.52 AM.png" width="1614" height="1042" /></p>
<p>Save this .csproj file and import this new .csproj file into your solution.</p>
<p><img class="alignnone size-full wp-image-6058" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/my-inventory-imported.png" alt="my-inventory-imported.png" width="400" height="436" /></p>
<p>Now you&#8217;re ready to tinker with this project.</p>
<h1>Configuring the Project Options</h1>
<p>First, let&#8217;s configure the project options to comply with Material. To do this, right-click on the project and choose <strong>Options</strong>. Or you can simply double-click the project to go to the Project Options.</p>
<p><img class="alignnone size-full wp-image-6072" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/project-options.png" alt="project-options.png" width="1302" height="932" /></p>
<p>In the dialog that appears, choose the <strong>General</strong> tab and set the <strong>Target Framework</strong> to <strong>Android 5.0 (Lollipop)</strong>.</p>
<p><img class="alignnone size-full wp-image-6077" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-10.17.53-AM.png" alt="Screen Shot 2016-03-11 at 10.17.53 AM.png" width="2169" height="1595" /></p>
<p>Next, choose the <strong>Android Application</strong> tab and edit the Package name to <strong>MyInventory.Android.Material</strong> (add .Material suffix, just to differentiate from the classic Android project). Set the <strong>Minimum Android version</strong> to <strong>Android 4.0.3 (API Level 15)</strong> and the Target Android version to <strong>API 21</strong>. Note: if you don&#8217;t specify the Target Android version explicitly (set it as Automatic), the Material theme won&#8217;t apply perfectly. It looks like a bug either from Xamarin side or Android SDK side. So to be safe, specify the <strong>Target Android version</strong> explicitly for now.</p>
<p><img class="alignnone size-full wp-image-6289" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-2.58.18-PM.png" alt="Screen Shot 2016-03-11 at 2.58.18 PM.png" width="2107" height="1589" /></p>
<p>Later, we&#8217;re going to modify the Application icon to use the new mipmap folders. But now, we&#8217;re good to go.</p>
<h1>Installing NuGet Packages</h1>
<p>Next, we&#8217;re going to install the latest NuGet packages for this project. You&#8217;ll want to install <strong>Intersoft.Crosslight</strong> onto the all of your projects (including the Core project), then install <strong>Intersoft.Crosslight.Android.v7</strong> package to your <strong>MyInventory.Android.Fragments.Material</strong> project. By now, I&#8217;ll assume that you&#8217;ve understood how to install these NuGet packages onto your existing projects. Should you find any troubles in installing the NuGet packages, consult the <a href="http://developer.intersoftsolutions.com/display/crosslight/Introduction+to+Crosslight+NuGet+Packages">docs</a>.</p>
<p>Here&#8217;s a shot when running the install <strong>Intersoft.Crosslight</strong> NuGet command. Note that this command only applies to Xamarin Studio on Mac. On Windows, you would simply use the <strong>Manage NuGet Packages for Solution</strong> menu from Visual Studio and search for the <strong>Intersoft.Crosslight</strong> package.</p>
<p><img class="alignnone size-full wp-image-6104" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/install-intersoft-crosslight1.png" alt="install-intersoft-crosslight.png" width="1380" height="436" /></p>
<p>And here&#8217;s another shot when installing the v7 package.</p>
<p><img class="alignnone size-full wp-image-6117" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/install-intersoft-crosslight-android-v7.png" alt="install-intersoft-crosslight-android-v7.png" width="1390" height="402" /></p>
<p>When you have successfully installed the packages, your project references should change a bit. (if you&#8217;re using Xamarin Studio on Mac)</p>
<p><img class="alignnone size-full wp-image-6121" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/references.png" alt="references.png" width="1405" height="822" /></p>
<h1>Refactoring the Classes</h1>
<p>Let&#8217;s proceed by refactoring the classes. Move the <strong>MainActivity.cs</strong> inside the Activities folder.</p>
<p><img class="alignnone size-full wp-image-6126" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/move-mainactivity.png" alt="move-mainactivity" width="400" height="852" /></p>
<p>Create a new folder called <strong>Fragments</strong> in the root project.</p>
<p><img class="alignnone size-full wp-image-6129" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/fragments-folder.png" alt="fragments-folder.png" width="300" height="820" /></p>
<p>Move all existing fragments (<strong>InventoryFragment.cs</strong>, <strong>ItemDetailFragment.cs</strong>, <strong>ItemListFragment.cs</strong>) inside the folder. Next, create a new <strong>Crosslight Android Material Activity</strong> using the new item template, and give it a name of <strong>AppActivity</strong>.</p>
<p><img class="alignnone size-full wp-image-6137" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-11.05.32-AM.png" alt="Screen Shot 2016-03-11 at 11.05.32 AM.png" width="1661" height="1294" /></p>
<p>Replace the contents of the <strong>AppActivity</strong> with the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">App</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">ItemListBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">Activity</span><span style="color: #333333;">()]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppActivity</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppCompatActivity</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ItemListViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppActivity</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">AppActivity</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>This will be a replacement for our <strong>ItemListActivity.cs</strong>. This is the main container Activity that will be launched after the splash screen is shown. Note that this class inherits from <strong>AppCompatActivity</strong> and takes in the ItemListViewModel, which corresponds to the <strong>AppService.cs</strong> specified in the <strong>MyInventory.Core/Infrastructure</strong> folder as the root ViewModel. It only contains two constructors, a default empty constructor and another constructor that takes in one <strong>IntPtr</strong> and <strong>JniHandleOwnership</strong> object. This is compulsory for every Activity and Fragment using the new Material library.</p>
<p>In the new Android Material library, developers now only need to focus on creating Fragments instead of Activity-Fragment pairs, as now the Activity will be automatically created as necessary upon screen navigation. Let&#8217;s create new Fragments and modify existing Fragments that will act as the counterpart for our current Activities.</p>
<h1>Preparing ItemListFragment</h1>
<p>First, let&#8217;s edit the ItemListFragment.cs inside the Fragments folder. Replace it with the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Graphics</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Graphics</span><span style="color: #333333;">.</span><span style="color: #333333;">Drawables</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">.</span><span style="color: #333333;">ComponentModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> EditAction </span><span style="color: #333333;">=</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">.</span><span style="color: #333333;">ComponentModels</span><span style="color: #333333;">.</span><span style="color: #3364a4;">EditAction</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">ItemListBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">RegisterNavigation</span><span style="color: #333333;">(</span><span style="color: #3364a4;">DeviceKind</span><span style="color: #333333;">.</span><span style="color: #333333;">Phone</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemListFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">SearchableRecyclerViewFragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ItemListViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemListFragment</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemListFragment</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">int</span><span style="color: #333333;"> </span><span style="color: #333333;">ItemLayoutId</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Layout</span><span style="color: #333333;">.</span><span style="color: #c44c57;">item_layout</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ImageLoaderSettings</span><span style="color: #333333;">.</span><span style="color: #333333;">AnimateOnLoad</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">Appearance</span><span style="color: #333333;">.</span><span style="color: #333333;">Background</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ColorDrawable</span><span style="color: #333333;">(</span><span style="color: #3364a4;">Color</span><span style="color: #333333;">.</span><span style="color: #333333;">WhiteSmoke</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ShowGroupSeparator</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">false</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Defines</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">floating</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">action</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">button</span><span style="font-style: italic; color: #888888;">.</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">FloatingActionButtons</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FloatingActionButton</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">AddButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                    Position </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FloatingActionButtonPosition</span><span style="color: #333333;">.</span><span style="color: #333333;">BottomRight</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    CommandItemType </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CommandItemType</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    Direction </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FloatingActionButtonDirection</span><span style="color: #333333;">.</span><span style="color: #333333;">Up</span><span style="color: #333333;">,</span><br />
<span style="color: #333333;">                    HideOnScrollUp </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">})</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Defines</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">contextual</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">action</span><span style="font-style: italic; color: #888888;">.</span><br />
<span style="color: #333333;">            </span><span style="color: #3364a4;">ListContextualToolbarSettings</span><span style="color: #333333;"> </span><span style="color: #333333;">settings</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ContextualToolbarSettings</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ListContextualToolbarSettings</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">settings</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">settings</span><span style="color: #333333;">.</span><span style="color: #333333;">Mode</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ContextualMode</span><span style="color: #333333;">.</span><span style="color: #333333;">Default</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">settings</span><span style="color: #333333;">.</span><span style="color: #333333;">CheckAllEnabled</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">settings</span><span style="color: #333333;">.</span><span style="color: #333333;">CheckAllMargin</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">4</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">settings</span><span style="color: #333333;">.</span><span style="color: #333333;">BarItems</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BarItem</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">DeleteButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Delete</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">settings</span><span style="color: #333333;">.</span><span style="color: #333333;">BarItems</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BarItem</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">MarkSoldButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Mark</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">As</span><span style="color: #f57d00;"> </span><span style="color: #f57d00;">Sold</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Defines</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">editing</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">action</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">from</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">swipe</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">gesture</span><span style="font-style: italic; color: #888888;">.</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">EditActions</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditAction</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Sold</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">EditActions</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditAction</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Delete</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Recycler</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">View</span><span style="font-style: italic; color: #888888;"> configuration</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">InteractionMode</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ListViewInteraction</span><span style="color: #333333;">.</span><span style="color: #333333;">Navigation</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">EditingOptions</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditingOptions</span><span style="color: #333333;">.</span><span style="color: #333333;">AllowEditing</span><span style="color: #333333;"> | </span><span style="color: #3364a4;">EditingOptions</span><span style="color: #333333;">.</span><span style="color: #333333;">AllowMultipleSelection</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Defines</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">shared</span><span style="font-style: italic; color: #888888;"> elements</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SourceSharedElementIds</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Id</span><span style="color: #333333;">.</span><span style="color: #333333;">Icon</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBarItem</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BarItem</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">SearchButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CommandItemType</span><span style="color: #333333;">.</span><span style="color: #333333;">Search</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">FilterScope</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Name</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">IconId</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Drawable</span><span style="color: #333333;">.</span><span style="color: #c44c57;">ic_toolbar</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>In the code above, we have our 2 constructors as explained earlier, then the ItemLayoutId, which we&#8217;ll create in just a moment, then we specify all the behaviors for that particular Fragment by overriding the <strong>Initialize</strong> method. Here, we specified several things. Let&#8217;s take it from the top.</p>
<p>We specified that the <strong>ImageLoader</strong> component should animate on load for a nice fading effect. We&#8217;ve also set the background of this Fragment by setting it through this.Appearance.Background property. The group separator is hidden. We&#8217;ve also specified a Floating Action Button with the identifier of <strong>AddButton </strong>and several options such as its position, <strong>CommandItemType</strong>, <strong>Direction</strong> and <strong>HideOnScrollUp</strong> behavior. We&#8217;ve also specified the contextual actions, which will be triggered when users long-presses an item. The new swipe gesture is also enabled by specifying the <strong>EditActions</strong>.</p>
<p>The RecyclerView configuration comes next, we&#8217;ve specified how the item should interact when user clicks/presses on an item. The <strong>EditingOptions</strong> is also specified here to allow contextual actions. Then comes the Shared Element Transition that will define which view IDs should be animated upon navigation. The new Fragment also allows to add Toolbar items programmatically by using the <strong>this.AddBarItem</strong> method. The <strong>FilterScope</strong> is specified for the item searching scope, so when user performs search on this Fragment, it will search for the item <strong>Name</strong>. Lastly, we specified which icon should be placed in the upper left hand corner of the Toolbar.</p>
<p>Also take note that ItemListFragment inherits the SearchableRecyclerViewFragment that uses RecyclerView and allows for searching of items. To learn more about the power of Material Fragment and all of its customizable properties, consult this documentation: <a href="http://developer.intersoftsolutions.com/display/crosslight/Using+Material+Fragment" target="_blank">Using Material Fragment</a>.</p>
<p>If you try to run the project now, you&#8217;ll get two errors saying that the <strong>item_layout.axml</strong> is not available and the <strong>ic_toolbar.png</strong> drawable is not available. Let&#8217;s sort this out. Create a new <strong>item_layout.axml</strong> file inside the <strong>Resources/Layout</strong> folder and use the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">intersoft</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">crosslight</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">v7</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">CardView</span><span style="color: #3364a4;"> </span><span style="color: #333333;">xmlns:app</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">http</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">schemas</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">com</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">apk</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">res</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">auto</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">xmlns:android</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">http</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">schemas</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">com</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">apk</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">res</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:foreground</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">?</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">attr</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">selectableItemBackground</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginLeft</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">8dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginRight</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">8dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_marginBottom</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">8dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">app:cardElevation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">2dp</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">RelativeLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">80dp</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ImageView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">72dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">72dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Icon</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_margin</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">4dp</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center_vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_centerVertical</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LinearLayout</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_toRightOf</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Icon</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center_vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_centerVertical</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:orientation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">vertical</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">TextView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:textAppearance</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">?</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">attr</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">textAppearanceMedium</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">TextLabel</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:ellipsize</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">end</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:singleLine</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">TextView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:textAppearance</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">?</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">attr</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">textAppearanceSmall</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">Text2</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:singleLine</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">true</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">RelativeLayout</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">intersoft</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">crosslight</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">android</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">v7</span><span style="color: #3364a4;">.</span><span style="color: #3364a4;">CardView</span><span style="color: #333333;">&gt;</span></span></p>
<p>In the item layout, we&#8217;re going to use the CardView as our item layout. Next, use this new icon (it&#8217;s white) for the Toolbar icon.</p>
<p><img class="alignnone size-full wp-image-6204" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/ic_toolbar.png" alt="ic_toolbar.png" width="48" height="48" /></p>
<p>Save this file inside the Resources/drawable folder and give it a name of <strong>ic_toolbar.png</strong>. A design tip: Since the new Material Design emphasizes on bold colors, it is better and preferred to use a thin icon design for a more beautiful outlook. In this case, the White color is chosen since it blends perfectly with Material colors.</p>
<h1>Cleaning Up Unnecessary Files</h1>
<p>Before we proceed, let&#8217;s delete some unnecessary files. In the <strong>Activities</strong> folder, leave only <strong>AppActivity.cs</strong> and <strong>MainActivity.cs</strong>, and delete all other Activity files as we&#8217;ll recreate the counterpart for these files as we go on.</p>
<p><img class="alignnone size-full wp-image-6219" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/delete-activities.png" alt="delete-activities.png" width="300" height="378" /></p>
<p>In the <strong>Fragments</strong> folder, delete <strong>InventoryFragment.cs</strong>, leaving only <strong>ItemListFragment.cs</strong>.</p>
<p><img class="alignnone size-full wp-image-6236" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/delete-fragments1.png" alt="delete-fragments.png" width="300" height="500" /></p>
<p>In the Resources folder, delete these folders: <strong>color</strong>, <strong>layout-large</strong>, <strong>values-large</strong>. And also delete all other layouts inside the <strong>layout</strong> folder, leaving only <strong>item_layout.axml</strong>.</p>
<p><img class="alignnone size-full wp-image-6229" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/delete-layouts.png" alt="delete-layouts.png" width="300" height="266" /></p>
<p>In the <strong>drawable</strong> folder, delete these highlighted files.</p>
<p><img class="alignnone size-full wp-image-6233" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/delete-drawables.png" alt="delete-drawables.png" width="300" height="580" /></p>
<p>Also, delete unused styles inside the <strong>styles.xml </strong>so your styles look like this.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">resources</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">style</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Theme</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">Splash</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">parent</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">Theme</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">item</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">windowBackground</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">@drawable/dark_splash</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">item</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">item</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">windowNoTitle</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">true</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">item</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">style</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">resources</span><span style="color: #333333;">&gt;</span></span></p>
<h1>Using the Material Theme</h1>
<p>To use the Material Theme, open <strong>AndroidManifest.xml</strong> located inside the <strong>Properties</strong> folder and change <strong>android:theme </strong>to use<strong> android:theme=&#8221;@style/Theme.Crosslight.Material.Light&#8221;</strong>.</p>
<p><img class="alignnone size-full wp-image-6245" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-1.24.28-PM.png" alt="Screen Shot 2016-03-11 at 1.24.28 PM.png" width="3104" height="1380" /></p>
<h1>Running the Project</h1>
<p>Let&#8217;s run the project and check out what will happen.</p>
<p><img class="alignnone size-full wp-image-6296" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/material-preliminary1.png" alt="material-preliminary" width="400" height="990" /></p>
<p>At a first glance, it looks fine. The Floating Action Button is showing, the Toolbar now uses the new Material Toolbar. However, this screen is still missing the title in the Toolbar. Let&#8217;s apply the Title for the Toolbar.</p>
<h1>Applying Title in the ViewModel</h1>
<p>In Crosslight 5, we&#8217;ve provided a simpler API to set the Title for a View that works across iOS and Android. To do this, simply open up <strong>ItemListViewModel.cs</strong> located inside the <strong>MyInventory.Core/ViewModels</strong> folder. Simply add <strong>this.Title = &#8220;My Inventory&#8221;</strong> in the ViewModel&#8217;s constructor.</p>
<p><img class="alignnone size-full wp-image-6268" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/title.png" alt="title.png" width="1288" height="488" /></p>
<h1>Customizing Material Colors</h1>
<p>By default, Crosslight Android Material uses the Blue theme color for the Material Design color palette. You can easily customize each UI element color by overriding the key values for the Material colors, as defined in the <a href="http://developer.android.com/training/material/theme.html" target="_blank">Android Training docs</a>. For example, let&#8217;s replace the Blue color palette with the Deep Purple palette. Replace <strong>colors.xml</strong> with the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">resources</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">primary</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#673AB7</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">accent</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#7E57C2</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">navigation_bar</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#9575CD</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">primary_dark</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#7E57C2</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">window_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#eaeaea</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">action_menu_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#673AB7</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">window_dark_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#000000</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">window_light_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span></span></p>
<p><span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">action_menu_foreground</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">button_foreground</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span></p>
<p><span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">nav_end_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#4527A0</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">nav_center_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#673AB7</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">nav_start_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#7E57C2</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span></p>
<p><span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">nav_header_title_foreground</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">nav_header_subtitle_foreground</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span></p>
<p><span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">progress_dialog_background</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#673AB7</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">progress_text_color</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">progress_bar_color</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#ffffff</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">progress_text_color_inverse</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#7E57C2</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">  </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">color</span><span style="color: #3364a4;"> </span><span style="color: #333333;">name</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">progress_bar_color_inverse</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">#7E57C2</span><span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">color</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">resources</span><span style="color: #333333;">&gt;</span></p>
<p>By default, we&#8217;ve followed the Material Color guidelines from Google as defined in the <a href="https://www.google.com/design/spec/style/color.html" target="_blank">Google documentation</a>. Clean and rebuild your project, then re-run the project. If you skip rebuilding, sometimes your resources will still be cached and the colors will not apply properly. Your project now should look like the following illustration.</p>
<p><img class="alignnone size-full wp-image-6312" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/material-item-list-view.png" alt="material-item-list-view.png" width="400" height="990" /></p>
<p>It seems our item list screen is roughly finished for now.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/qC643K8Tcbc?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>As you can see in the video, the EditActions for Sold and Delete swipe gesture still don&#8217;t work properly for now. Let&#8217;s make it work by modifying the <strong>ItemListViewModel</strong>.</p>
<h1>Enabling Swipe Gestures</h1>
<p>As you&#8217;ve seen previously, to enable the swipe gesture for the RecyclerView can be simply done by overriding the <strong>Initialize</strong> method and adding the <strong>EditActions</strong> for the Fragment.</p>
<p><span style="font-family: Menlo;"> <span style="font-style: italic; color: #888888;">//</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">Defines</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">editing</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">action</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">from</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">swipe</span><span style="font-style: italic; color: #888888;"> </span><span style="font-style: italic; color: #888888;">gesture</span><span style="font-style: italic; color: #888888;">.</span><br />
<span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">EditActions</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditAction</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Sold</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">EditActions</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditAction</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">Delete</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span></span></p>
<p>Modify the <strong>ItemListViewModel</strong> inside the <strong>MyInventory.Core/ViewModels</strong> folder and override the <strong>ExecuteEditAction</strong> method.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteEditAction</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #3364a4;">EditingParameter</span><span style="color: #333333;"> </span><span style="color: #333333;">editingParameter</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">EditingParameter</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">editingParameter</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #3364a4;">Item</span><span style="color: #333333;"> </span><span style="color: #333333;">item</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">editingParameter</span><span style="color: #333333;">.</span><span style="color: #333333;">Item</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Item</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">item</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">string</span><span style="color: #333333;"> </span><span style="color: #333333;">editAction</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">editingParameter</span><span style="color: #333333;">.</span><span style="color: #333333;">CustomAction</span><span style="color: #333333;">.</span><span style="color: #333333;">ToLowerInvariant</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">switch</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">editAction</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">case</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">sold</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">:</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ExecuteMarkSold</span><span style="color: #333333;">(</span><span style="color: #333333;">item</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">break</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #009695;">case</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">delete</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">:</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">ExecuteDelete</span><span style="color: #333333;">(</span><span style="color: #333333;">item</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                    </span><span style="color: #009695;">break</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #333333;">editingParameter</span><span style="color: #333333;">.</span><span style="color: #333333;">ShouldEndEditing</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>When user performs swipe gesture on the cell, the <strong>EditAction</strong> command will be automatically called on every edit action defined in the Fragment. So in the above case, the <strong>EditAction</strong> command will be called twice, one for the Sold action and another for the Delete action.</p>
<p>One thing to note is that if you return the <strong>CanExecuteEditAction </strong>in the ViewModel to false, the button for the designated action will not be presented to the user. It&#8217;s also worth mentioning that when executing the swipe gesture, you can try to debug the <strong>EditingParameter</strong> as it contains useful information, such as the <strong>Action</strong>, <strong>CustomAction</strong>, <strong>Item</strong>, <strong>RowIndex</strong>, <strong>SectionIndex</strong> and <strong>ShouldEndEditing</strong> properties.</p>
<p>And modify the ExecuteMarkSold method as follows.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">private</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">ExecuteMarkSold</span><span style="color: #333333;">(</span><span style="color: #009695;">object</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">parameter</span><span style="color: #333333;"> </span><span style="color: #009695;">is</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IEnumerable</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Item</span><span style="color: #333333;">&gt;)</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #3364a4;">IEnumerable</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Item</span><span style="color: #333333;">&gt;</span><span style="color: #333333;"> </span><span style="color: #333333;">items</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">IEnumerable</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">Item</span><span style="color: #333333;">&gt;</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">items</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">foreach</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #3364a4;">Item</span><span style="color: #333333;"> item </span><span style="color: #009695;">in</span><span style="color: #333333;"> </span><span style="color: #333333;">items</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">item</span><span style="color: #333333;">.</span><span style="color: #333333;">IsSold</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">                </span><span style="color: #333333;">item</span><span style="color: #333333;">.</span><span style="color: #333333;">SoldDate</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DateTime</span><span style="color: #333333;">.</span><span style="color: #333333;">Today</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">                </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnDataChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">item</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">else</span><span style="color: #333333;"> </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #333333;">parameter</span><span style="color: #333333;"> </span><span style="color: #009695;">is</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Item</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">var</span><span style="color: #333333;"> </span><span style="color: #333333;">item</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #333333;">parameter</span><span style="color: #333333;"> </span><span style="color: #009695;">as</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Item</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">item</span><span style="color: #333333;">.</span><span style="color: #333333;">IsSold</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">true</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">item</span><span style="color: #333333;">.</span><span style="color: #333333;">SoldDate</span><span style="color: #333333;"> </span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #3364a4;">DateTime</span><span style="color: #333333;">.</span><span style="color: #333333;">Today</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">OnDataChanged</span><span style="color: #333333;">(</span><span style="color: #333333;">item</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">    </span><span style="color: #009695;">if</span><span style="color: #333333;"> </span><span style="color: #333333;">(</span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SelectedItems</span><span style="color: #333333;"> !</span><span style="color: #333333;">=</span><span style="color: #333333;"> </span><span style="color: #009695;">null</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SelectedItems</span><span style="color: #333333;">.</span><span style="color: #333333;">Clear</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">}</span></p>
<p>Then, modify the <strong>ItemListBindingProvider.cs</strong> inside the <strong>MyInventory.Core/BindingProviders</strong> folder and add the following line.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBinding</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">TableView</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindableProperties</span><span style="color: #333333;">.</span><span style="color: #333333;">EditActionCommandProperty</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">EditActionCommand</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BindingMode</span><span style="color: #333333;">.</span><span style="color: #333333;">TwoWay</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></span></p>
<p>Now the swipe gesture should work properly.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/wFrLZKVvIew?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>&nbsp;</p>
<h1>Preparing ItemEditFragment</h1>
<p>Now that we have our item list screen ready, let&#8217;s include the new FormFragment to edit and add new items to the list. Right-click on the Fragments folder and choose <strong>Crosslight Android Material Form Fragment</strong> and give it a name of <strong>ItemEditFragment</strong>.</p>
<p><img class="alignnone size-full wp-image-6342" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-3.53.59-PM.png" alt="Screen Shot 2016-03-11 at 3.53.59 PM.png" width="1653" height="1261" /></p>
<p>Replace the contents with the following code.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">ItemListBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemEditFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">FormFragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ItemEditorViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemEditFragment</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ItemEditFragment</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Methods</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">void</span><span style="color: #333333;"> </span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">base</span><span style="color: #333333;">.</span><span style="color: #333333;">Initialize</span><span style="color: #333333;">()</span><span style="color: #333333;">;</span></p>
<p><span style="color: #333333;">            </span><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">AddBarItem</span><span style="color: #333333;">(</span><span style="color: #009695;">new</span><span style="color: #333333;"> </span><span style="color: #3364a4;">BarItem</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">SaveButton</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">CommandItemType</span><span style="color: #333333;">.</span><span style="color: #333333;">Done</span><span style="color: #333333;">))</span><span style="color: #333333;">;</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Let&#8217;s take it from the top. This class inherits the new <strong>FormFragment</strong> class, which is used to display <strong>Crosslight Form Builder</strong> and takes in the <strong>ItemEditViewModel</strong>. We have two default constructors as usual, then the <strong>Initialize</strong> method is overridden to add toolbar items programmatically. The <strong>SaveButton</strong> indicates the view identifier used for the toolbar item. This convenient method lets Android developers add common commands to the Toolbar without touching any .axml files and inflate the menu. As a side note, if you wish to use the old way of inflating .axml files for the menu, it is still supported. Now when you run the project, you should be able to navigate to the form to Edit and Add new items.</p>
<p><img class="alignnone size-full wp-image-6369" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/form-fragment.png" alt="form-fragment.png" width="1026" height="906" /></p>
<h1>Configuring Shared Element Transitions</h1>
<p>As you can see, your current app can now navigate to the item editor screen using modal transitions. However, it won&#8217;t as look as good with shared element transitions. Let&#8217;s enable the shared element transitions to the form editor view. If you remember, we&#8217;ve defined the <strong>SourceSharedElementIds</strong> from the <strong>ItemListFragment</strong>.</p>
<p><span style="color: #009695;">this</span><span style="color: #333333;">.</span><span style="color: #333333;">SourceSharedElementIds</span><span style="color: #333333;">.</span><span style="color: #333333;">Add</span><span style="color: #333333;">(</span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Id</span><span style="color: #333333;">.</span><span style="color: #333333;">Icon</span><span style="color: #333333;">)</span><span style="color: #333333;">;</span></p>
<p>To enable shared transitions, modify <strong>ItemEditFragment</strong> and add this line inside the <strong>Initialize</strong> method: <strong>this.SharedImageIndex = 0;</strong></p>
<p><img class="alignnone size-full wp-image-6383" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/shared-image-index.png" alt="shared-image-index.png" width="1086" height="316" /></p>
<p>Let&#8217;s re-run the project.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='604' height='370' src='http://www.youtube.com/embed/1IgWLEwI0DI?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<p>Now you should get a nice shared element transition when navigating to the FormFragment.</p>
<h1>View Image Fragment</h1>
<p>We still need to prepare the a final Fragment, which is the ViewImageFragment, which is needed when you click on the image in the FormFragment.</p>
<p><img class="alignnone size-full wp-image-6399" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/view-larger.png" alt="view-larger.png" width="400" height="908" /></p>
<p>Let&#8217;s prepare this view. Create a new Fragment inside the Fragments folder and give it a name of ViewImageFragment.</p>
<p><img class="alignnone size-full wp-image-6401" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-11-at-5.17.54-PM.png" alt="Screen Shot 2016-03-11 at 5.17.54 PM.png" width="1698" height="1292" /></p>
<p>Replace the contents of the file with the following.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">using</span><span style="color: #333333;"> System</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Android</span><span style="color: #333333;">.</span><span style="color: #333333;">Runtime</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> Intersoft</span><span style="color: #333333;">.</span><span style="color: #333333;">Crosslight</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><span style="color: #333333;">.</span><span style="color: #333333;">v7</span><span style="color: #333333;">;</span><br />
<span style="color: #009695;">using</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">ViewModels</span><span style="color: #333333;">;</span></span></p>
<p><span style="color: #009695;">namespace</span><span style="color: #333333;"> MyInventory</span><span style="color: #333333;">.</span><span style="color: #333333;">Android</span><br />
<span style="color: #333333;">{</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">ImportBinding</span><span style="color: #333333;">(</span><span style="color: #009695;">typeof</span><span style="color: #333333;">(</span><span style="color: #3364a4;">ItemDetailBindingProvider</span><span style="color: #333333;">))]</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">[</span><span style="color: #3364a4;">RegisterNavigation</span><span style="color: #333333;">(</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">PhotoDetail</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">)]</span><br />
<span style="color: #333333;">    </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #009695;">class</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ViewImageFragment</span><span style="color: #333333;"> </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Fragment</span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ItemDetailViewModel</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Constructors</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ViewImageFragment</span><span style="color: #333333;">()</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">public</span><span style="color: #333333;"> </span><span style="color: #3364a4;">ViewImageFragment</span><span style="color: #333333;">(</span><span style="color: #3364a4;">IntPtr</span><span style="color: #333333;"> </span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #3364a4;">JniHandleOwnership</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">            </span><span style="color: #333333;">:</span><span style="color: #333333;"> </span><span style="color: #009695;">base</span><span style="color: #333333;">(</span><span style="color: #333333;">javaReference</span><span style="color: #333333;">,</span><span style="color: #333333;"> </span><span style="color: #333333;">transfer</span><span style="color: #333333;">)</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#region</span><span style="color: #c12dac;"> Properties</span></p>
<p><span style="color: #333333;">        </span><span style="color: #009695;">protected</span><span style="color: #333333;"> </span><span style="color: #009695;">override</span><span style="color: #333333;"> </span><span style="color: #009695;">int</span><span style="color: #333333;"> </span><span style="color: #333333;">ContentLayoutId</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">{</span><br />
<span style="color: #333333;">            </span><span style="color: #009695;">get</span><span style="color: #333333;"> </span><span style="color: #333333;">{</span><span style="color: #333333;"> </span><span style="color: #009695;">return</span><span style="color: #333333;"> </span><span style="color: #3364a4;">Resource</span><span style="color: #333333;">.</span><span style="color: #3364a4;">Layout</span><span style="color: #333333;">.</span><span style="color: #c44c57;">view_image_layout</span><span style="color: #333333;">;</span><span style="color: #333333;"> </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">        </span><span style="color: #333333;">}</span></p>
<p><span style="color: #333333;">        </span><span style="color: #c12dac;">#endregion</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">}</span><br />
<span style="color: #333333;">}</span></p>
<p>Then, create the layout for <strong>view_image_layout.axml</strong> file inside the <strong>Resources/layout</strong> folder. Replace the contents of the AXML with the following.</p>
<p><span style="font-family: Menlo;"> <span style="color: #009695;">&lt;?</span><span style="color: #333333;">xml</span><span style="color: #333333;"> </span><span style="color: #333333;">version</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">1</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">0</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;"> </span><span style="color: #333333;">encoding</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">utf</span><span style="color: #f57d00;">&#8211;</span><span style="color: #f57d00;">8</span><span style="color: #f57d00;">&#8220;</span><span style="color: #009695;">?&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #3364a4;"> </span><span style="color: #333333;">xmlns:android</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">http</span><span style="color: #f57d00;">:</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">schemas</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">.</span><span style="color: #f57d00;">com</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">apk</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">res</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">android</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:orientation</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">vertical</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">TextView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">NameLabel</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:gravity</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">center</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">wrap_content</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">    </span><span style="color: #333333;">&lt;</span><span style="color: #3364a4;">ImageView</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:id</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">@</span><span style="color: #f57d00;">+</span><span style="color: #f57d00;">id</span><span style="color: #f57d00;">/</span><span style="color: #f57d00;">ImageView</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_width</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><br />
<span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #3364a4;"> </span><span style="color: #333333;">android:layout_height</span><span style="color: #333333;">=</span><span style="color: #f57d00;">&#8220;</span><span style="color: #f57d00;">match_parent</span><span style="color: #f57d00;">&#8220;</span><span style="color: #3364a4;"> </span><span style="color: #333333;">/</span><span style="color: #333333;">&gt;</span><br />
<span style="color: #333333;">&lt;</span><span style="color: #333333;">/</span><span style="color: #3364a4;">LinearLayout</span><span style="color: #333333;">&gt;</span></span></p>
<p>This app should be pretty much complete. There&#8217;s one last thing might want to apply, but this step is completely optional.</p>
<h1>Using mipmap Icons</h1>
<p>Did you notice that the app icon is not crisp and high-res enough?</p>
<p><img class="alignnone size-full wp-image-6413" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/app-icon.png" alt="app-icon.png" width="400" height="876" /></p>
<p>To overcome this, you can take advantage of mipmap folders so that the icons become more crisp. Quoting from the <strong>Android developers blog: </strong></p>
<p class="p1"><span class="s1">It’s best practice to place your app icons in </span><span class="s2">mipmap-</span><span class="s1"> folders (not the </span><span class="s2">drawable-</span><span class="s1"> folders) because they are used at resolutions different from the device’s current density. </span></p>
<p class="p1">What this means, if your device falls under ldpi, it can use mdpi icons to show a more high-res launcher icon.</p>
<p class="p1">Let&#8217;s try to see if this is true. Download and extract this <a href="http://developer.intersoftsolutions.com/download/attachments/23702119/mipmap.zip?api=v2">mipmap</a> zip file and put it under the Resource folder, same level as drawable, layouts and values.</p>
<p class="p1"><img class="alignnone size-full wp-image-6423" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/mipmap-folders.png" alt="mipmap-folders.png" width="300" height="548" /></p>
<p class="p1">Then modify <strong>MainActivity.cs </strong>inside the <strong>Activities</strong> folder to use the new mipmap icon.</p>
<p class="p1"><img class="alignnone size-full wp-image-6425" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/change-icon.png" alt="change-icon.png" width="1746" height="164" /></p>
<p class="p1">Replace Icon property of the ActivityAttribute with &#8220;@mipmap/icon&#8221;, rebuild and re-run your project.</p>
<p class="p1"><img class="alignnone size-full wp-image-6431" src="http://blog.intersoftsolutions.com/wp-content/uploads/2016/03/icon-comparison.png" alt="icon-comparison.png" width="1022" height="876" />As you can see, with the new mipmap technique, your app icon should be very sharp. Small, but noticable improvement. You should only use mipmap folders for launcher icon purposes. Your app is now finished.</p>
<p>&nbsp;</p>
<h1>Learn More</h1>
<p>What you&#8217;ve just did is just a glimpse of the full power of the Material Fragment. I highly suggest you to visit the improved docs for Material design. Start from this article and move your way to its children nodes: <a href="http://developer.intersoftsolutions.com/display/crosslight/Crosslight+Android+Material+Development" target="_blank">Crosslight Android Material Development</a>.</p>
<h1>Samples</h1>
<p>You can obtain the finished sample <a href="http://git.intersoftpt.com/projects/CT/repos/crosslightmaterialmigration/browse" target="_blank">here</a>.</p>
<h1>Conclusion</h1>
<p>I hope you&#8217;ve enjoyed this post as much as I&#8217;m writing it. Hopefully you can follow this tutorial without any hassles and start migrating your existing classic Android apps to Material in no time. Should you have any questions, feel free to <a href="http://www.intersoftsolutions.com/#livechat" target="_blank">initiate a live chat</a> with us, as always.</p>
<p>Till next post,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2016/03/migrating-to-crosslight-android-material/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
