<?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; MVVM</title>
	<atom:link href="http://blog.intersoftsolutions.com/tag/mvvm/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 Crosslight Charting</title>
		<link>http://blog.intersoftsolutions.com/2015/10/getting-started-with-crosslight-charting/</link>
		<comments>http://blog.intersoftsolutions.com/2015/10/getting-started-with-crosslight-charting/#comments</comments>
		<pubDate>Wed, 21 Oct 2015 06:25:00 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2015 R1]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Charting]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[UI Components]]></category>

		<guid isPermaLink="false">http://blog.intersoftsolutions.com/?p=4759</guid>
		<description><![CDATA[One of the greatest new components in Crosslight 4 is a powerful, full-fledged Charting component, enabling Crosslight developers to easily add stunning charts to their business cross-platform mobile apps. Fully MVVM capable, it works beautifully across iOS and Android platforms. Have you checked out the new Crosslight Charting yet? If not, then this post [...]]]></description>
				<content:encoded><![CDATA[<img width="604" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/crosslight-charting-604x270.png" class="attachment-post-thumbnail wp-post-image" alt="crosslight-charting" style="float:right; margin:0 0 10px 10px;" /><p>One of the greatest new components in Crosslight 4 is a powerful, full-fledged Charting component, enabling Crosslight developers to easily add stunning charts to their business cross-platform mobile apps. Fully MVVM capable, it works beautifully across iOS and Android platforms.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/crosslight-charting.png"><img class="alignnone size-large wp-image-4786" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/crosslight-charting-1024x910.png" alt="crosslight-charting" width="604" height="537" /></a></p>
<p>Have you checked out the new Crosslight Charting yet? If not, then this post is the perfect guide for you. This post will help you learn how to get started with Crosslight Charting.</p>
<h1>Starting Off</h1>
<p>Let’s try to create the illustrated column chart from scratch. To start off, I created a Blank Crosslight project with Crosslight Project Wizard. I&#8217;ll call this CrosslightCharting for now. After the project is created, don’t forget to add the necessary references as well.</p>
<p><a href="file://localhost//Users/nicholaslie/Library/Containers/com.blogo.Blogo/Data/Library/Caches/com.blogo.Blogo/1445403569_full.png" target="_blank"><img class="aligncenter" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/1445403604_thumb.png" alt="" align="middle" /></a></p>
<h2>Necessary References</h2>
<ul>
<li>Core project: Add <strong>Intersoft.Crosslight.UI.DataVisualization</strong> assembly.</li>
<li>iOS project: Add<strong> Intersoft.Crosslight.UI.DataVisualization</strong> and <strong>Intersoft.Crosslight.UI.DataVisualization.iOS</strong> assembly.</li>
<li>Android project: Add <strong>Intersoft.Crosslight.UI.DataVisualization</strong> and <strong>Intersoft.Crosslight.UI.DataVisualization.Android</strong> assembly.</li>
</ul>
<p>Now you&#8217;re ready to begin writing some codes.</p>
<h1>Preparing the ViewModel</h1>
<p>Let’s prepare the ViewModel that will provide the data to the chart. I&#8217;m going to create a <em>ColumnViewModel</em> class inside the <em>CrosslightCharting.Core/ViewModels</em> folder, and write really simple code to initialize the <em>Chart model</em>. Here&#8217;s how.</p><pre class="crayon-plain-tag">using Intersoft.Crosslight.UI.DataVisualization;
using Intersoft.Crosslight.ViewModels;

namespace CrosslightCharting.Core
{
    public class ColumnViewModel : ViewModelBase&lt;ColumnSeries&gt;
    {
        private Chart _chart;

        public Chart Chart
        {
            get { return _chart; }
            set
            {
                _chart = value;
                OnPropertyChanged("Chart");
            }
        }

        public ColumnViewModel()
        {
            InitializeChart();
        }

        private void InitializeChart()
        {
            this.Chart = new Chart();
            this.Chart.Title.Text = "Agile Sprint Status";

            // setup series for In Progress
            Series inProgressSeries = new ColumnSeries();
            inProgressSeries.Title = "In Progress";
            inProgressSeries.Items = new List&lt;DataPoint&gt;();
            inProgressSeries.Items.Add(new DataPoint("Android", 70));
            inProgressSeries.Items.Add(new DataPoint("iOS", 42));
            inProgressSeries.Items.Add(new DataPoint("WinPhone", 20));
            this.Chart.Series.Add(inProgressSeries);

            // setup series for Resolved
            Series resolvedSeries = new ColumnSeries();
            resolvedSeries.Title = "Resolved";
            resolvedSeries.Items.Add(new DataPoint("Android", 53));
            resolvedSeries.Items.Add(new DataPoint("iOS", 32));
            resolvedSeries.Items.Add(new DataPoint("WinPhone", 40));
            this.Chart.Series.Add(resolvedSeries);
        }
    }
}</pre><p>As you can see, all we did is simply initializing the chart in the ViewModel and populated two <em>ColumnSeries</em> for it, and add the data points for each series which will be displayed side-by-side. Crosslight Charting library includes <em>component models</em> that you can consume in the shared Core project. The <em>Chart model </em>represents the data source required for the chart, and also provides a wealth of chart configuration and settings. The <em>Series</em>, <em>ColumnSeries</em>, and <em>DataPoint</em> are another example of the component models available in the Charting library.</p>
<p>For the sake of simplicity, the above sample uses static data points as the <em>items source</em> for each series. If your data points are heavily reused across your application, you can definitely refactor the data points into a repository or data manager class which you can easily consume with a simple method call. Later, you can learn more about it from my sample project.</p>
<p>It&#8217;s also noteworthy to point out that changes to the <em>Chart model</em> will automatically propagated to the view, thanks to the powerful binding architecture of Crosslight. This means you can add or remove <em>Series</em> dynamically in your app. Of course, you can also set the <em>items source</em> of the <em>Series</em> later in the app&#8217;s cycle, such as after fetching data from the server in most real-world scenarios. Better yet, changes you made to the <em>Chart model</em> will not be only propagated to the view, they will be also smoothly animated from the current point to the new point. Absolutely no additional code needed, it just works!</p>
<p>For your reference, here&#8217;s a code snippet how to initialize the items source of a Series combined with an async data load.</p><pre class="crayon-plain-tag">protected override async void Navigated(NavigatedParameter parameter)
{
    this.Chart.Series.First().Items = await this.Repository.GetAgileStatusAsync("In Progress");
}</pre><p>That&#8217;s pretty cool, right?</p>
<p>Crosslight Charting emphasizes not only on powerful charting capabilities, but also provides developers with easy-to-use and intuitive APIs, so you can get things done without having to worry about the heavy work. If you notice, you don&#8217;t necessarily need to define the dependent and independent axes for the chart, since Crosslight Charting comes with automatic axis detection that generates meaningful axis and range, purely based on the given data. Simply beautiful.</p>
<p>&nbsp;</p>
<h1>Preparing the BindingProvider</h1>
<p>Since our ViewModel and <em>Chart model</em> is ready, let&#8217;s prepare the <em>Binding Provider</em> which will bind the C<em>hart model</em> to the view. This is where the magic will happen.</p>
<p>Simply create a new Crosslight Binding Provider using the item templates built into Visual Studio (Windows) or Xamarin Studio (Mac). I&#8217;ll call this <em>ColumnBindingProvider</em>, and I&#8217;ll put it inside the CrosslightCharting.Core/BindingProviders folder.</p><pre class="crayon-plain-tag">#region Usings

using Intersoft.Crosslight;
using Intersoft.Crosslight.UI.DataVisualization;

#endregion

namespace CrosslightCharting.Core
{
    public class ColumnBindingProvider : BindingProvider
    {
        #region Constructors

        public ColumnBindingProvider()
        {
            this.AddBinding("ChartView", ChartProperties.ChartProperty, new BindingDescription("Chart", BindingMode.TwoWay));
        }

        #endregion
    }
}</pre><p>There&#8217;s not much to explain here as the code is self explanatory. It simply binds the <em>ChartView</em> to the <em>Chart</em> property of the ViewModel. That&#8217;s it. Now you have the ViewModel with complete data populated as well as the BindingProvider.</p>
<h1>Creating the Chart for iOS</h1>
<p>You&#8217;re now ready to create the ViewController that will host the chart in iOS. I&#8217;ll create a new ViewController called <em>ColumnViewController</em> inside the CrosslightCharting.iOS/ViewControllers folder. Here&#8217;s the <em>ColumnViewController </em>file:</p><pre class="crayon-plain-tag">#region Usings

using CrosslightCharting.Core;
using Intersoft.Crosslight;
using Intersoft.Crosslight.UI.DataVisualization.iOS;

#endregion

namespace CrosslightCharting.iOS
{
    [ImportBinding(typeof(ColumnBindingProvider))]
    public partial class ColumnViewController : UIChartViewController&lt;ColumnViewModel&gt;
    {
        protected override void InitializeView()
        {
            base.InitializeView();

            this.NavigationItem.Title = "Column Series";
        }
    }
}</pre><p>As you see from the code above, the ViewController contains almost nothing except for the BindingProvider and the ViewModel I&#8217;ve just created before. Also note that you need to subclass the <em>UIChartViewController</em> class. The UIChartViewController provides a ChartView property which returns the instance of UIChartView that it manages. It also automatically registers the <em>ChartView</em> as an identifier, allowing you to easily bind to the chart view in the binding provider.</p>
<p>Simply run the project to see the Crosslight Charting in action.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/Simulator-Screen-Shot-October-21-2015-2.46.47-PM.png"><img class=" size-medium wp-image-4783 aligncenter" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/Simulator-Screen-Shot-October-21-2015-2.46.47-PM-169x300.png" alt="Simulator Screen Shot October 21, 2015, 2.46.47 PM" width="169" height="300" /></a></p>
<p>You&#8217;ve just created your first Crosslight Charting application in iOS. Congratulations! Well, how about the Android platform?</p>
<h1>Creating the Chart for Android</h1>
<p>Well, since you&#8217;ve prepared the ViewModel and the BindingProvider, so, as you guessed it, all you need to do, is just to provide the &#8220;view&#8221; for Android platform. Let&#8217;s create an Activity for that. I&#8217;ll call it <em>ColumnActivity</em>, and put it inside the CrosslightCharting.Android/Activities folder.</p><pre class="crayon-plain-tag">#region Usings

using Android.App;
using Intersoft.Crosslight.Android;
using CrosslightCharting.Core;
using Intersoft.Crosslight;

#endregion

namespace CrosslightCharting.Android
{
    [Activity(Label = "Column Series")]		
    [ImportBinding(typeof(ColumnBindingProvider))]
    public class ColumnActivity : Activity&lt;ColumnViewModel&gt;
    {
        protected override int ContentLayoutId
        {
            get
            {
                return Resource.Layout.ColumnSeriesLayout;
            }
        }
    }
}</pre><p>Again, nothing&#8217;s here except for the ViewModel and the BindingProvider we&#8217;ve created earlier. As you can see, I&#8217;ve provided a layout for this activity by creating an Android layout file inside the CrosslightCharting.Android/Resources/Layout folder, called <em>ColumnSeriesLayout.axml</em>. Let&#8217;s see how this file looks like.</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/white"
    android:gravity="center"&gt;
    &lt;Intersoft.Crosslight.UI.DataVisualization.Android.ChartView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/ChartView" /&gt;
&lt;/LinearLayout&gt;</pre><p>The layout is simply a ChartView that covers the entire screen. I&#8217;ve also put a white background to get better visibility of the chart. Android version is done. Let&#8217;s see it in action.</p>
<p><a href="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/Nexus-5-Lollipop-Screenshot-2.png"><img class="aligncenter wp-image-4787 size-medium" src="http://blog.intersoftsolutions.com/wp-content/uploads/2015/10/Nexus-5-Lollipop-Screenshot-2-169x300.png" alt="Nexus 5 Lollipop Screenshot 2" width="169" height="300" /></a></p>
<p>&nbsp;</p>
<p>Now, I want you to pay attention to how Crosslight Charting manages to create the axes automatically for you, and define the &#8220;smart&#8221; ranges for those axes that fits the screen nicely. Also notice that the legend is automatically generated for you based on the given data points. How cool is that? See, I told you that it works consistently between iOS and Android platform.</p>
<p>And if you need to customize anything about the Chart, whether its data source, series, or other settings, you do it only once in the  ViewModel. At this point, I hope you&#8217;ve started to get the point how Crosslight works in overall, and how it lives to its highly acclaimed <em>100% shared UI logic</em>.</p>
<h1>Learning more about Crosslight Charting</h1>
<p>You&#8217;ve successfully created a column chart with Crosslight Charting. In addition to column charts, Crosslight Charting also supports many other chart types such as area, bar, doughnut, line, pie, scatter, step area, and much more.</p>
<p>If you&#8217;re interested in learning more, I highly suggest you to check out the list of topics here:</p>
<ul>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Understanding+Chart+Series">Understanding chart series</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Understanding+Chart+Axis">Understanding chart axis</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Understanding+Chart+Legend">Understanding chart legend</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Understanding+Chart+Title">Understanding chart title</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Configuring+Chart+Appearance">Configuring chart appearance</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Understanding+Animation">Understanding animation</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Enabling+Zoom">Enabling zoom</a></li>
<li><a href="http://developer.intersoftsolutions.com/display/crosslight/Using+Data+Annotation">Using data annotation</a></li>
</ul>
<p>I also highly recommend you to check out the samples directly to see all of the features hands-on. It is available in the Git repository in this <a href="http://git.intersoftsolutions.com/projects/CROS-SUPP/repos/charting-sample/browse">link</a>.</p>
<p>You can also find the source code to this our Git repository <a href="http://git.intersoftsolutions.com/projects/CT/repos/crosslightcharting/browse">here</a>.</p>
<p>Till next post,</p>
<p>Cheers<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2015/10/getting-started-with-crosslight-charting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video Tutorial: Creating Your First Crosslight App</title>
		<link>http://blog.intersoftsolutions.com/2014/08/video-tutorial-creating-your-first-crosslight-app/</link>
		<comments>http://blog.intersoftsolutions.com/2014/08/video-tutorial-creating-your-first-crosslight-app/#comments</comments>
		<pubDate>Tue, 05 Aug 2014 13:56:53 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2014 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[ClientUI]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://intersoftpt.wordpress.com/?p=3832</guid>
		<description><![CDATA[For those of you new to cross-platform development, fear not. Crosslight is here to the rescue. Building cross-platform apps has never been easier using Crosslight. Crosslight is a cross-platform toolset that helps you to create cross-platform apps using C#, leveraging the MVVM pattern. If you [...]]]></description>
				<content:encoded><![CDATA[<img width="436" height="250" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/08/2-crosslight.png" class="attachment-post-thumbnail wp-post-image" alt="2-crosslight" style="float:right; margin:0 0 10px 10px;" /><p>For those of you new to cross-platform development, fear not. Crosslight is here to the rescue. Building cross-platform apps has never been easier using Crosslight. Crosslight is a cross-platform toolset that helps you to create cross-platform apps using C#, leveraging the MVVM pattern. If you haven&#8217;t got a copy of Crosslight, grab one <a href="http://www.intersoftpt.com/RequestTrial" target="_blank">here</a>!</p>
<p>To help you get started, we have just released a new video tutorial that will help you to create your first Crosslight app using the Crosslight Project Wizard and run the project on all four platforms: iOS, Android, Windows Phone and Windows Store.</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/kSktcy1ws-c?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>Find out more about Crosslight at our <a href="http://developer.intersoftpt.com/display/crosslight/Home" target="_blank">Developer Center</a>. Also checkout <a href="http://developer.intersoftpt.com/display/crosslight/Crosslight+Starter+Guide" target="_blank">our newbie-proof Crosslight tutorial</a>. If you have any questions, feel free to post it in our <a href="http://intersoftpt.com/community/crosslight" target="_blank">community forum</a>, or <a href="mailto:technical@intersoftpt.com" target="_blank">drop us a mail</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2014/08/video-tutorial-creating-your-first-crosslight-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video Tutorial: Getting Started with Crosslight Reporting Service</title>
		<link>http://blog.intersoftsolutions.com/2014/06/video-tutorial-getting-started-with-crosslight-reporting-service/</link>
		<comments>http://blog.intersoftsolutions.com/2014/06/video-tutorial-getting-started-with-crosslight-reporting-service/#comments</comments>
		<pubDate>Wed, 18 Jun 2014 16:24:20 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2014 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[ClientUI]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://intersoftpt.wordpress.com/?p=3788</guid>
		<description><![CDATA[Crosslight 2 provides a capability to view enterprise reports across multiple platforms including iOS, Android, Windows Phone and Windows 8. The reporting services is built upon the company&#8217;s flagship reporting, ClientUI Reporting, to produce identical reports across multiple platforms. You can quickly add reporting feature [...]]]></description>
				<content:encoded><![CDATA[<img width="436" height="250" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/08/5-reporting.png" class="attachment-post-thumbnail wp-post-image" alt="5-reporting" style="float:right; margin:0 0 10px 10px;" /><p>Crosslight 2 provides a capability to view enterprise reports across multiple platforms including iOS, Android, Windows Phone and Windows 8. The reporting services is built upon the company&#8217;s flagship reporting, ClientUI Reporting, to produce identical reports across multiple platforms. You can quickly add reporting feature to your apps since Crosslight has encapsulated all of the functionality required to display the reports on multiple platforms natively. Check out the following video to learn how to configure the report server and display the report on Crosslight apps, which runs on four major platforms: iOS, Android, Windows Phone 8 and Windows Store.</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/_9Nfn18foIM?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>You can also get the source code for this video from our new Git server: <a href="http://git.intersoftpt.com/projects/CROS-SUPP/repos/simple-reporting/browse">http://git.intersoftpt.com/projects/CROS-SUPP/repos/simple-reporting/browse</a>. To learn more about Crosslight reporting service and how it works, see <a href="http://developer.intersoftpt.com/display/crosslight/Viewing+Enterprise+Reports" target="_blank">Viewing Enterprise Reports</a>. If you have any questions, feel free to post it in our <a href="http://intersoftpt.com/community/crosslight" target="_blank">community forum</a>, or <a href="mailto:technical@intersoftpt.com" target="_blank">drop us a mail</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2014/06/video-tutorial-getting-started-with-crosslight-reporting-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Batch Update with MVVM support in Crosslight iOS</title>
		<link>http://blog.intersoftsolutions.com/2014/06/advanced-batch-update-with-mvvm-support-in-crosslight-ios/</link>
		<comments>http://blog.intersoftsolutions.com/2014/06/advanced-batch-update-with-mvvm-support-in-crosslight-ios/#comments</comments>
		<pubDate>Mon, 09 Jun 2014 04:10:13 +0000</pubDate>
		<dc:creator><![CDATA[Jimmy Petrus]]></dc:creator>
				<category><![CDATA[2014 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[MVVM]]></category>

		<guid isPermaLink="false">http://intersoftpt.wordpress.com/?p=3764</guid>
		<description><![CDATA[If you are iOS users, you might already familiar with the Mail app. When new messages arrived, notice that the new items are inserted smoothly with beautiful animation. The implementation for such insertion is in deed challenging since it needs to take account the actual [...]]]></description>
				<content:encoded><![CDATA[<img width="511" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/batchupdateillustration_thumb1-604x319.png" class="attachment-post-thumbnail wp-post-image" alt="BatchUpdateIllustration" style="float:right; margin:0 0 10px 10px;" /><p>If you are iOS users, you might already familiar with the Mail app. When new messages arrived, notice that the new items are inserted smoothly with beautiful animation. The implementation for such insertion is in deed challenging since it needs to take account the actual insertion position based on the sorted data. Furthermore, multiple insertions are also supported with simultaneous animation which adds complexity to the logic. Technically, inserting an item will cause the index of remaining items invalid — and not to mention if there are deletion along the process. There are a lot of aspects that need to be considered. In this blog post, I will share how we support this user experience seamlessly in Crosslight 2.</p>
<p>iOS supports this simultaneous updates through a feature called batch updating. Implementing this feature requires deep knowledge of how iOS works — and typically what you want to avoid, particularly if your code is targeting multiple platforms. Thankfully, Crosslight has supported this batch update operation since its first version by allowing you to simply perform updates to your collection in .NET way. You don’t need to know about iOS even a bit.</p>
<p>Recently, we made several improvements to Crosslight for batch update support in a sorted collection. This allows you to simply adding items or deleting items on a sorted collection without concerning the actual position where it will be displayed or removed. The Crosslight’s table view component now takes care everything behind the scene, including the batch updating process, maintaining the delta changes and simultaneously animate the changes.</p>
<p>Consider you have a raw collection of countries: US, China, Japan, Netherlands, and Greece. When bound to the view, the collection is sorted by the country name in ascending with LINQ. At runtime, you then add few more countries: Indonesia, Brazil, and Mexico.</p>
<p>In ViewModel, the C# code looks like below.</p><pre class="crayon-plain-tag">public class BatchUpdateListViewModel : EditableListViewModelBase&lt;Country&gt;
{
    public DelegateCommand BatchUpdateCommand { get; set; }

    public BatchUpdateListViewModel()
    {
        var items = new List&lt;Country&gt;();
        items.AddRange(Countries.Create("US", "China", "Japan", "Netherlands", "Greece"));

        // just a plain .NET collection here
        this.SourceItems = items.ToObservable();

        this.BatchUpdateCommand = new DelegateCommand(ExecuteBatchUpdate);
    }

    private void ExecuteBatchUpdate(object parameter)
    {
        // Begin batch updating
        this.IsBatchUpdating = true;

        // Perform multiple inserts simultaneously to the source items
        this.SourceItems.Add(new Country("Indonesia"));
        this.SourceItems.Add(new Country("Brazil"));
        this.SourceItems.Add(new Country("Mexico"));

        // End batch updating
        // After this code, the bound list view will be automatically updated with smooth animation
        this.IsBatchUpdating = false;
    }

    protected override void OnSourceItemsChanged(ICollection&lt;Country&gt; items)
    {
        // Sort the source items by country name, and use the sorted collection for the display items
        this.Items = items != null ? items.OrderBy(country =&gt; country.Name) : null;
    }
}</pre><p>Notice that the above code simply adds items to the source collection, you don’t have to concern the actual positions in the view. The only thing you need to ensure is to perform the collection changes while the <strong>IsBatchUpdating</strong> property value is true. As soon as the property is set to false, the bound view will be automatically notified and perform the animation simultaneously. This simple and intuitive code lets you to achieve the stunning user experience similar to Apple’s built-in Mail app when new items are added dynamically at runtime.</p>
<p>The following illustration shows what happened to the sorted collection at runtime.</p>
<p><a href="https://intersoftpt.files.wordpress.com/2014/06/batchupdateillustration.png"><img style="background-image: none; padding-top: 0; padding-left: 0; display: inline; padding-right: 0; border-width: 0;" title="BatchUpdateIllustration" src="https://intersoftpt.files.wordpress.com/2014/06/batchupdateillustration_thumb.png" alt="BatchUpdateIllustration" width="631" height="319" border="0" /></a></p>
<p>To demonstrate this feature, we have added a new Sorted Batch Update to the Data Samples which you can download from our Git server. The bits is under the <a href="http://git.intersoftpt.com/projects/CROS/repos/samples/browse?at=refs%2Fheads%2Fbatch-update-sorted" target="_blank">batch-update-sorted</a> branch. You’ll also need nightly build (<a href="http://git.intersoftpt.com/projects/CROS/repos/updates/browse" target="_blank">revision 54 or higher</a>) to try out this new improvement.</p>
<p>In addition to multiple insertions, the sample also demonstrates multiple deletion. And to add more complexity, it also modifies the items which cause its order to change. For your convenience, you can see how the sample works below.</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/VGK_TVoPUu4?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>Most cross-platform frameworks I found today provide just a set of API without thoughtful consideration of the user experience that native to the platform. That’s where Crosslight sets apart. More than just a set of API, we designed Crosslight with the simplicity you expected, while taking account many other important factors behind the scene which will make your apps shine.</p>
<p>Join us for a 3-day live webinars on June 10 &#8211; 12, and learn how you can build great cross-platform business apps with Crosslight. We will be demo’ing how to create a fully-functional CRM app in just mere minutes — live. Seat is limited, so <a href="https://intersoftpt.com/promo/jun14webinar" target="_blank">reserve yours now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2014/06/advanced-batch-update-with-mvvm-support-in-crosslight-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video Tutorials: Understanding MVVM Pattern and Building Simple Tip Calculator App with Crosslight</title>
		<link>http://blog.intersoftsolutions.com/2013/12/video-tutorials-understanding-mvvm-pattern-and-building-simple-tip-calculator-app-with-crosslight/</link>
		<comments>http://blog.intersoftsolutions.com/2013/12/video-tutorials-understanding-mvvm-pattern-and-building-simple-tip-calculator-app-with-crosslight/#comments</comments>
		<pubDate>Mon, 23 Dec 2013 04:11:51 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2013 R1]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Video Tutorials]]></category>
		<category><![CDATA[Windows App Store]]></category>
		<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=3631</guid>
		<description><![CDATA[We have released two new video tutorials on Crosslight to help you better understand how to develop better mobile applications using Crosslight. Understanding MVVM Pattern in Crosslight This video tutorial outlines in general how the MVVM pattern works in Crosslight apps development. You will learn [...]]]></description>
				<content:encoded><![CDATA[<img width="436" height="250" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/08/Video-tutor-436x270.png" class="attachment-post-thumbnail wp-post-image" alt="Video-tutor-436x270" style="float:right; margin:0 0 10px 10px;" /><p>We have released two new video tutorials on Crosslight to help you better understand how to develop better mobile applications using Crosslight.</p>
<h1>Understanding MVVM Pattern in Crosslight</h1>
<p>This video tutorial outlines in general how the MVVM pattern works in Crosslight apps development. You will learn how Crosslight leverages the MVVM concept in order to produce cross-platform projects with a single shared application layer. By the end of this video, you will be able to grasp the MVVM pattern in general as well as getting the right mindset when building apps using Crosslight.</p>
<span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='360' src='http://www.youtube.com/embed/Ha_DuQidbvs?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>
<h1>Building Simple Tip Calculator using Crosslight</h1>
<p>This video tutorial explains how you can build a simple tip calculator app using Crosslight  within minutes that target all four major platforms at once (Android, iOS, Windows Phone, Windows 8). This video aims to highlight the data binding capabilities in Crosslight that leverages the MVVM pattern found in .NET applications to mobile apps development. You can find the source code for this video in our GitHub link: <a href="https://github.com/IntersoftSolutions/CrosslightSimpleTipCalculator">https://github.com/IntersoftSolutions/CrosslightSimpleTipCalculator</a></p>
<span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='360' src='http://www.youtube.com/embed/tlrlkLF7nOI?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>Should you have any further questions, feel free to contact us at <a href="mailto:technical@intersoftpt.com">technical@intersoftpt.com</a> or raise a thread in our <a href="http://intersoftpt.com/Community/Crosslight">forums</a>. Hopefully this video will give you a clearer concept how Crosslight works and how you can slash development time in more than half and increase your productivity. Stay tuned for more Crosslight video tutorials. Don’t forget to subscribe to <a href="http://www.youtube.com/user/intersoftpt">our YouTube channel</a> as well!</p>
<p>Cheers,<br />
Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2013/12/video-tutorials-understanding-mvvm-pattern-and-building-simple-tip-calculator-app-with-crosslight/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross Platform Mobile Development with Crosslight – Part 2</title>
		<link>http://blog.intersoftsolutions.com/2013/08/cross-platform-mobile-development-with-crosslight-part-2/</link>
		<comments>http://blog.intersoftsolutions.com/2013/08/cross-platform-mobile-development-with-crosslight-part-2/#comments</comments>
		<pubDate>Wed, 28 Aug 2013 12:07:53 +0000</pubDate>
		<dc:creator><![CDATA[Nicholas Lie]]></dc:creator>
				<category><![CDATA[2013 R1]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Crosslight]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Navigation Framework]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=3293</guid>
		<description><![CDATA[This is the second post of cross-platform mobile development with Crosslight series. Continuing from the previous post , I am most pleased to share two of the exciting features shipped with Crosslight: unified navigation framework and powerful data binding. Unified Navigation Framework As navigation differs [...]]]></description>
				<content:encoded><![CDATA[<img width="417" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/basic-navigation-on-ios_thumb1-540x350.jpg" class="attachment-post-thumbnail wp-post-image" alt="Basic Navigation on iOS" style="float:right; margin:0 0 10px 10px;" /><p>This is the second post of cross-platform mobile development with Crosslight series. Continuing from the <a href="http://intersoftpt.wordpress.com/2013/06/12/cross-platform-mobile-development-with-crosslight-part-1/">previous post</a> , I am most pleased to share two of the exciting features shipped with Crosslight: unified navigation framework and powerful data binding.</p>
<h1>Unified Navigation Framework</h1>
<p>As navigation differs from one mobile framework to another, it’s a challenging task for mobile developers to streamline the navigation logic all in one place that can work consistently between platforms. Take iOS, Android, Windows Phone, and WinRT for example. iOS uses push navigation while Android uses Intent-based navigation while Windows Phone and WinRT use Page-based navigation. Gone are the days you will have to worry about these troubles with Crosslight. This section will outline the features supported by Crosslight navigation framework.</p>
<h2>Basic Navigation</h2>
<p>Crosslight navigation supports basic navigation to a page using the view model.&nbsp; This is achieved using the navigation service from the view model and calling the <em>Navigate</em> method then specify the desired view model to navigate. It’s as simple as that.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/basic-navigation-on-ios.jpg"><img title="Basic Navigation on iOS" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Basic Navigation on iOS" src="http://intersoftpt.files.wordpress.com/2013/08/basic-navigation-on-ios_thumb.jpg" width="540" height="612"></a></p>
<p>At its simplest form, basic navigation can simply be done with the following simple calls from the view model:</p>
<p></p><pre class="crayon-plain-tag">private void ExecuteNavigateIdentifier(object parameter)
{
    this.NavigationService.Navigate("ViewModel1Derivative");
}

private void ExecuteNavigateParameter(object parameter)
{
    // You can pass any objects as parameter during navigation
    this.NavigationService.Navigate(new NavigationParameter(parameter));
}

private void ExecuteNavigateType(object parameter)
{
    this.NavigationService.Navigate();
}</pre><p></p>
<p>Note that you can also navigate to the same view model but consumed by different views using the <em>NavigationParameter </em>as shown above.</p>
<h2>List Navigation (Push Navigation)</h2>
<p>Crosslight navigation service enables you to perform navigation from within the view model. You can navigate to a view model by providing the type, or a known identifier.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/list-nav3.jpg"><img title="Unified List Navigation on WIndows Phone" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Unified List Navigation on WIndows Phone" src="http://intersoftpt.files.wordpress.com/2013/08/list-nav3_thumb.jpg" width="470" height="873"></a></p>
<p>The navigation view model looks as simple as this:</p>
<p></p><pre class="crayon-plain-tag">public class NavigationViewModel : ListViewModelBase
{
    public NavigationViewModel()
    {
        IApplicationContext context = this.GetService().GetContext();

        List items = new List();

        items.Add(new NavigationItem("Simple List", "Data View", typeof(SimpleListViewModel)));
        items.Add(new NavigationItem("Grouped List", "Data View", typeof(GroupListViewModel)));
        items.Add(new NavigationItem("Grouped List (Section)", "Data View", new NavigationTarget(typeof(GroupListViewModel), "GroupStyle")));
        items.Add(new NavigationItem("Grouped List with Index", "Data View", new NavigationTarget(typeof(GroupListViewModel), "GroupIndex")));
        items.Add(new NavigationItem("Searchable List", "Data View", typeof(FilterListViewModel)));
        
	...

        this.SourceItems = items;
        this.RefreshGroupItems();
    }

    public override void RefreshGroupItems()
    {
        if (this.Items != null)
            this.GroupItems = this.Items.GroupBy(o =&gt; o.Group).Select(o =&gt; new GroupItem(o)).ToList();
    }
}</pre><p></p>
<h2>Modal Navigation</h2>
<p>The integrated navigation service supports a special navigation type called as modal navigation. It is particularly useful to present a view that waits for user input; you can return a navigation result indicating whether the user provided the input or cancelled the input, as well as capturing additional data as the result of the modal navigation.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/swt1.jpg"><img title="Modal Navigation on Android" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Modal Navigation on Android" src="http://intersoftpt.files.wordpress.com/2013/08/swt_thumb1.jpg" width="541" height="709"></a></p>
<p>To execute a modal navigation, in the view model, we can specify as follows:</p>
<p></p><pre class="crayon-plain-tag">private void ExecuteNavigateModal(object parameter)
{
    NavigationParameter navigationParameter = new NavigationParameter()
    {
        NavigationMode = NavigationMode.Modal
    };

    ...

    this.NavigationService.Navigate(
        new NavigationTarget(typeof(ViewModel3), navigationParameter),
        (result) =&gt;
        {
            if (result.Action == NavigationResultAction.Cancel)
                this.MessagePresenter.Show("You cancelled the data input");
            else
                this.MessagePresenter.Show("You entered: " + result.Data.ToString());
        });
}</pre><p></p>
<p>Notice that after modal navigation is executed, you can handle the result of the modal navigation through action callbacks.</p>
<h2>Nested Modal Navigation</h2>
<p>In addition to basic modal navigation, the Crosslight navigation service also supports advanced modal navigation that allows you to perform navigation within the modal view context. Called <em>Nested Modal Navigation,</em> this feature is particularly useful when you need to capture numerous data input that are split to multiple views (wizard-like).</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/nested_modal1.jpg"><img title="Nested Modal Navigation on Windows Phone" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Nested Modal Navigation on WIndows Phone" src="http://intersoftpt.files.wordpress.com/2013/08/nested_modal1_thumb.jpg" width="585" height="327"></a></p>
<p>The navigation service manages the navigation stack made during the modal session. When the Close method is called, it automatically discards the entire modal navigation stack, and return to the initiator view.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/nested_modal2.jpg"><img title="Nested Modal Navigation Result on Windows Phone" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Nested Modal Navigation Result on Windows Phone" src="http://intersoftpt.files.wordpress.com/2013/08/nested_modal2_thumb.jpg" width="406" height="364"></a></p>
<p>It is quite simple to execute a nested modal navigation:</p>
<p></p><pre class="crayon-plain-tag">private void ExecuteNavigateModal(object parameter)
{
    NavigationParameter navigationParameter = new NavigationParameter(new RegistrationData())
    {
        NavigationMode = NavigationMode.Modal,
        EnsureNavigationContext = true
    };

    this.NavigationService.Navigate(
        new NavigationTarget(typeof(NestedStep1ViewModel), navigationParameter),
        (result) =&gt;
        {
            if (result.Action == NavigationResultAction.Cancel)
                this.MessagePresenter.Show("You cancelled the data input");
            else
                this.ShowRegistrationData(result.Data as RegistrationData);
        });
}</pre><p></p>
<p>Similar to the previous modal navigation, you can handle the result of the nested modal navigation through action callbacks through the nested modal view initiator.</p>
<h2>Master-Detail Navigation</h2>
<p>The Crosslight navigation service supports master-detail navigation, both when deployed to a phone device or a tablet device. On a phone device, the navigation would be interpreted as push navigation while on a tablet it would be treated differently based on the targeted platform. </p>
<p>On phone, it will look like this:</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/phone.jpg"><img title="Master Detail Navigation on Phone" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Master Detail Navigation on Phone" src="http://intersoftpt.files.wordpress.com/2013/08/phone_thumb.jpg" width="337" height="316"></a></p>
<p>While on tablet:</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/3p.png"><img title="Master Detail Navigation on Tablet" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Master Detail Navigation on Tablet" src="http://intersoftpt.files.wordpress.com/2013/08/3p_thumb.png" width="516" height="361"></a></p>
<p>For iOS and Android, you would need a binding provider that specifies the detail view model when the item is tapped.</p>
<p></p><pre class="crayon-plain-tag">public class ListNavigationBindingProvider : BindingProvider
{
    #region Constructors

    public ListNavigationBindingProvider()
    {
        ItemBindingDescription itemBinding = new ItemBindingDescription()
        {
            DisplayMemberPath = "Name",
            DetailMemberPath = "Location",
            ImageMemberPath = "ThumbnailImage"
        };

        this.AddBinding("TableView", BindableProperties.ItemsSourceProperty, "Items");
        this.AddBinding("TableView", BindableProperties.ItemTemplateBindingProperty, itemBinding, true);
        this.AddBinding("TableView", BindableProperties.SelectedItemProperty, "SelectedItem", BindingMode.TwoWay);
        this.AddBinding("TableView", BindableProperties.DetailNavigationTargetProperty, new NavigationTarget(typeof(ItemDetailViewModel)), true);
    }

    #endregion
}</pre><p></p>
<h2>Tab Navigation</h2>
<p>The navigation service also supports tab navigation using selected index. By inheriting a special view model called <em>MultiPageViewModelBase</em>, you can perform navigation setting the selected index of the navigation items. You can also send parameters and custom objects during tab navigation.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/tabbed1.jpg"><img title="Tabbed Navigation on iOS" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Tabbed Navigation on iOS" src="http://intersoftpt.files.wordpress.com/2013/08/tabbed_thumb1.jpg" width="409" height="375"></a></p>
<p>The TabViewModel that enables tab navigation:</p>
<p></p><pre class="crayon-plain-tag">public class TabViewModel : MultiPageViewModelBase
{
    #region Constructors

    public TabViewModel()
    {
        var items = new List();
        items.Add(new NavigationItem("Simple Page", typeof(SimpleViewModel)) { Image = "first.png" });
        items.Add(new NavigationItem("About", typeof(AboutNavigationViewModel)) { Image = "second.png" });

        this.Items = items.ToArray();
    }

    #endregion
}</pre><p></p>
<h1>Powerful Data-Binding Features</h1>
<p>Crosslight was designed with the powerful MVVM design pattern in mind. The MVVM design pattern itself is almost always associated with data-binding concept. .NET developers targeting Silverlight and WPF will be at home with the concept. However, this post will not cover the concepts of data-binding itself, but more on how Crosslight leverages this concept to the mobile development world, which were only available to platforms such as Silverlight and WPF. If you would like to learn more about data-binding concept, Microsoft has detailed a very good article <a href="http://msdn.microsoft.com/en-us/library/ms752347.aspx">here</a> that covers the topic in-depth.</p>
<h2>Property-to-Property Binding</h2>
<p>Crosslight data-binding framework supports the very basic property-to-property data binding, enabling you to bind a property to another property using various information contained in <em>BindingDescription </em>using a <em>BindingProvider</em> class<em>.</em></p>
<p></p><pre class="crayon-plain-tag">public class BindingModeBindingProvider : BindingProvider
{
    public BindingModeBindingProvider()
    {
        this.AddBinding("Label1", BindableProperties.TextProperty, "Text", BindingMode.OneTime);
        this.AddBinding("Label2", BindableProperties.TextProperty, "Text", BindingMode.OneWay);
        this.AddBinding("TextField1", BindableProperties.TextProperty, "Text", BindingMode.TwoWay);
        this.AddBinding("Label3", BindableProperties.TextProperty, "Amount", BindingMode.OneWay);
        this.AddBinding("Slider1", BindableProperties.ValueProperty, "Amount", BindingMode.TwoWay);
        this.AddBinding("TextField2", BindableProperties.TextProperty, "Amount", BindingMode.TwoWay);
        this.AddBinding("Stepper1", BindableProperties.ValueProperty, "Amount", BindingMode.TwoWay);
    }
}</pre><p></p>
<h2>Universal Data Management</h2>
<p>Crosslight data binding framework supports automatic UI updates when bound to a collection. This allows for easier data management as well as saving you the trouble of updating the UI when the underlying data model changes. Consider the following view model:</p>
<p></p><pre class="crayon-plain-tag">private void ExecuteBatchUpdate(object parameter)
{
    // Begin updating
    this.IsBatchUpdating = true;

    // Perform multiple add and remove simultaneously
    var items = this.Items.ToObservable();
    var updatedItem = items.ElementAt(0);

    updatedItem.Name = "Modified at " + DateTime.Now.ToString("hh:mm:ss");
    this.OnDataChanged(updatedItem);

    items.Insert(1, new Item {Name = "New Item " + this.NewIndex++, Location = "New warehouse", ThumbnailImage = updatedItem.ThumbnailImage});
    items.Insert(3, new Item {Name = "New Item " + this.NewIndex++, Location = "New warehouse", ThumbnailImage = updatedItem.ThumbnailImage});
    items.Insert(6, new Item {Name = "New Item " + this.NewIndex++, Location = "New warehouse", ThumbnailImage = updatedItem.ThumbnailImage});

    items.Remove(items.ElementAt(5));
    items.Remove(items.ElementAt(7));

    this.ToastPresenter.Show("Added 3 items, removed 2 items, updated 1 item", null, null, ToastDisplayDuration.Immediate, ToastGravity.Center);

    // End updating
    this.IsBatchUpdating = false;
}</pre><p></p>
<p>After you have finished inserting items to the model, the view updates accordingly.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/batch_update.jpg"><img title="Universal Data Management on iPhone" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Universal Data Management on iPhone" src="http://intersoftpt.files.wordpress.com/2013/08/batch_update_thumb.jpg" width="607" height="319"></a></p>
<h2>Binding to Nested Property</h2>
<p>Aside from binding to a top-level property, you can also bind to a nested property.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/winrt_nested.png"><img title="Binding to Nested Property on WinRT" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Binding to Nested Property on WinRT" src="http://intersoftpt.files.wordpress.com/2013/08/winrt_nested_thumb.png" width="594" height="357"></a></p>
<h2></h2>
<h2>Case 1: Loan Calculator</h2>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/loan-converter1.png"><img title="Loan Calculator" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Loan Calculator" src="http://intersoftpt.files.wordpress.com/2013/08/loan-converter_thumb1.png" width="585" height="398"></a> </p>
<p>A simple app that can be made using the data-binding framework is the loan calculator where you would input the amount of loan, the loan term in years, and the interest rate per year.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/loan_calculator-copy.jpg"><img title="Loan Calculator Result on Android" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Loan Calculator Result on Android" src="http://intersoftpt.files.wordpress.com/2013/08/loan_calculator-copy_thumb.jpg" width="592" height="236"></a></p>
<p>Each of the textboxes and the button is bound using a <em>BindingProvider.</em></p>
<p></p><pre class="crayon-plain-tag">public class LoanCalculatorBindingProvider : BindingProvider
{
    public LoanCalculatorBindingProvider()
    {
        this.AddBinding("AmountTextField", BindableProperties.TextProperty, "Amount", BindingMode.TwoWay);
        this.AddBinding("LoanTermTextField", BindableProperties.TextProperty, "LoanTerm", BindingMode.TwoWay);
        this.AddBinding("InterestRateTextField", BindableProperties.TextProperty, "InterestRate", BindingMode.TwoWay);
        this.AddBinding("MonthlyPaymentLabel", BindableProperties.TextProperty, new BindingDescription("MonthlyPayment") { StringFormat = "{0:c}" });
        this.AddBinding("CalculateButton", BindableProperties.CommandProperty, "CalculateCommand");
    }
}</pre><p></p>
<p>After inputting the specified amount, loan term, and interest rate, and hit calculate, it calculates the monthly payment by calling the command specified in the view model, as follows:</p>
<p></p><pre class="crayon-plain-tag">private decimal GetCalculateMontlyPayment()
{
    return decimal.Round((this.Amount + (this.Amount * this.InterestRate * (decimal)this.LoanTerm)) / ((decimal)this.LoanTerm * (decimal)12),2);
}</pre><p></p>
<h2>Case 2: Currency Converter</h2>
<p>Another simple example would be to make an offline currency converter. This example demonstrates Crosslight support for binding with full converter and <em>UpdateSourceTrigger</em> support.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/currency-converter1.png"><img title="Currency Converter" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Currency Converter" src="http://intersoftpt.files.wordpress.com/2013/08/currency-converter_thumb1.png" width="582" height="260"></a></p>
<h2>Full Converter Support</h2>
<p>Just like the native binding found in Silverlight and WPF platforms, Crosslight also supports binding with converter, complete with converter parameter and converter culture.</p>
<h2>UpdateSourceTrigger Support </h2>
<p>Intersoft Crosslight provides four predefined <em>UpdateSourceTrigger </em>values, namely <em>Default, Explicit, LostFocus, </em>and <em>PropertyChanged</em>. By default, the update process to the bound property will be done after lost focus event is triggered. The following code shows how you can use the two-way <em>BindingMode</em> as well as setting the <em>UpdateSourceTrigger</em> to <em>PropertyChanged</em>.</p>
<p></p><pre class="crayon-plain-tag">public class CurrencyConverterBindingProvider : BindingProvider
{
    public CurrencyConverterBindingProvider()
    {
        CurrencyFormatConverter converter = new CurrencyFormatConverter();

        this.AddBinding("BaseCurrencyTextField", BindableProperties.TextProperty, new BindingDescription("USCurrency", BindingMode.TwoWay, UpdateSourceTrigger.PropertyChanged));
        this.AddBinding("BritishCurrencyTextField", BindableProperties.TextProperty, new BindingDescription("UKCurrency") { Converter = converter, ConverterParameter = "{0:c}", ConverterCulture = new CultureInfo("en-gb") });
        this.AddBinding("EuroCurrencyTextField", BindableProperties.TextProperty, new BindingDescription("EuroCurrency") { Converter = converter, ConverterParameter = "{0:c}", ConverterCulture = new CultureInfo("nl-NL") });
        this.AddBinding("SGCurrencyTextField", BindableProperties.TextProperty, new BindingDescription("SGCurrency") { Converter = converter, ConverterParameter = "{0:c}", ConverterCulture = new CultureInfo("zh-sg") });
        this.AddBinding("AUCurrencyTextField", BindableProperties.TextProperty, new BindingDescription("AUCurrency") { Converter = converter, ConverterParameter = "{0:c}", ConverterCulture = new CultureInfo("en-au") });
    }
}</pre><p></p>
<p>As a result, the respective currencies will be converted in real time when the text is changed.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/currn1-copy1.jpg"><img title="Currency Converter on iOS" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="Currency Converter on iOS" src="http://intersoftpt.files.wordpress.com/2013/08/currn1-copy1_thumb.jpg" width="550" height="419"></a></p>
<h2>StringFormat Support</h2>
<p>Crosslight <em>BindingProvider </em>also supports binding with <em>StringFormat</em> support.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2013/08/3p1.png"><img title="StringFormat Support on Windows Phone" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="StringFormat Support on Windows Phone" src="http://intersoftpt.files.wordpress.com/2013/08/3p_thumb1.png" width="273" height="513"></a></p>
<p></p><pre class="crayon-plain-tag">public class StringFormatBindingProvider : BindingProvider
{
    public StringFormatBindingProvider()
    {
        this.AddBinding("Label1", BindableProperties.TextProperty, new BindingDescription("Amount", BindingMode.OneWay) { StringFormat = "{0:c0}" });
        this.AddBinding("Label2", BindableProperties.TextProperty, new BindingDescription("Amount", BindingMode.OneWay) { StringFormat = "{0:###,###.00}" });
        this.AddBinding("Label3", BindableProperties.TextProperty, new BindingDescription("Date", BindingMode.OneWay) { StringFormat = "{0:g}" });
        this.AddBinding("Label4", BindableProperties.TextProperty, new BindingDescription("Date", BindingMode.OneWay) { StringFormat = "{0:F}" });

        this.AddBinding("Slider1", BindableProperties.ValueProperty, "Amount", BindingMode.TwoWay);
        this.AddBinding("DatePicker1", BindableProperties.ValueProperty, "Date", BindingMode.TwoWay);
    }
}</pre><p></p>
<h1>Wrap-up</h1>
<p>Navigation and data-binding are just some of the features Crosslight introduced to the mobile development world. It is important to note while all these features are shown platform specific, they work consistently across multiple platforms. The diverse pictures shown in this blog post is to give you an overview about the features described earlier were not platform-specific; they can be applied cross-platform. Some of the Crosslight API outlined in the code snippets are not explained in detail here; they will be covered comprehensively in our product documentation upon release. You might wonder, while these features sound too good to be true, in fact, they really are. These magical features will be available as soon as we hit our 2013 R1 milestone, which is going to be released very soon in early September. </p>
<p>Regards,</p>
<p>Nicholas Lie</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2013/08/cross-platform-mobile-development-with-crosslight-part-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>New Line-of-Business Samples in ClientUI 7</title>
		<link>http://blog.intersoftsolutions.com/2012/06/new-line-of-business-samples-in-clientui-7/</link>
		<comments>http://blog.intersoftsolutions.com/2012/06/new-line-of-business-samples-in-clientui-7/#comments</comments>
		<pubDate>Fri, 29 Jun 2012 09:32:27 +0000</pubDate>
		<dc:creator><![CDATA[martinlie]]></dc:creator>
				<category><![CDATA[2012 R1]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[ClientUI]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[New Releases]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=2767</guid>
		<description><![CDATA[Introducing the new data controls lineups such as UXPageableComboBox UXMultipleSelectionComboBox and UXTreeList, developers can now build large-scale data entry applications with blazing fast performance. UXGridView also adds with several enhancements and advanced features such as columns collection binding, column header binding and batch items validation. [...]]]></description>
				<content:encoded><![CDATA[<img width="464" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/cabinfront_thumb1.png" class="attachment-post-thumbnail wp-post-image" alt="CabinFront" style="float:right; margin:0 0 10px 10px;" /><p>Introducing the new data controls lineups such as UXPageableComboBox UXMultipleSelectionComboBox and UXTreeList, developers can now build large-scale data entry applications with blazing fast performance. UXGridView also adds with several enhancements and advanced features such as columns collection binding, column header binding and batch items validation. Click <a href="http://www.clientui.com/New">here</a> to find out more about the new controls in ClientUI 7.</p>
<p>In this blog post, I will share some of the new samples demonstrating the new products, as well as reviewing the key features.</p>
<p>Below are some of the top new samples that goes to my favorite list.</p>
<ol>
<li><strong>Cabin Front Reservation<br /></strong>
<p>UXPageableComboBox is an enhanced UXDataComboBox control featuring highly efficient server paging mechanism. The control addresses performance issues in large data scenario by retrieving only the required data on demand, and perform incremental data retrieval when the total item count exceeds the specified page size.</p>
<p>In this sample, you are able to perform Multiple columns layout with built-in column type such as Text, Images and Templates. You can perform sorting and description text feature using this control. With description text, you can show additional information related to the selected item in the right edge of the control. It is used to allow you easily understand the meaning of the input value at a glance. <a href="http://live.clientui.com/#/DataControls/UXPageableComboBox" target="_blank">Explore the sample</a>.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/cabinfront.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="CabinFront" border="0" alt="CabinFront" src="http://intersoftpt.files.wordpress.com/2012/06/cabinfront_thumb.png" width="595" height="346"></a></p>
<p>&nbsp;</p>
<li><strong>Customer Order<br /></strong>In this sample, you will see the tight integration between UXGridView and UXPageableComboBox. You can edit a column in UXGridView and bind it with UXPageableComboBox. With this feature, you can fully use all features available in UXPageableComboBox inside UXGridView, such as Multiple columns layout, Auto-complete behavior, advanced data grouping and sorting capability and many more. <a href="http://live.clientui.com/#/DataControls/UXPageableComboBox/InsideGridView" target="_blank">Explore the sample</a>.
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/customerorder.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="CustomerOrder" border="0" alt="CustomerOrder" src="http://intersoftpt.files.wordpress.com/2012/06/customerorder_thumb.png" width="587" height="383"></a></p>
<li><strong>Mail Application<br /></strong>UXMultipleSelectionComboBox is an advanced queryable ComboBox control specially designed to support multiple selection. It provides an intuitive data entry mode that allows users to quickly select multiple items through type-and-tab gesture. It supports both Editable and Readonly mode. This control has every features that are available in UXPageableComboBox.
<p>In this sample, editable mode is used. It means that you can directly update the selection through the text input element. The control filters the data instantaneously as you type ahead, and the selection will be added with a single Tab key. Also, the built-in smart filter feature automatically prevents any items that you have selected to appear on the list for the next selection. <a href="http://live.clientui.com/#/DataControls/UXMultipleSelectionComboBox" target="_blank">Explore the sample</a>.</li>
</ol>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/mailapplication.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="MailApplication" border="0" alt="MailApplication" src="http://intersoftpt.files.wordpress.com/2012/06/mailapplication_thumb.png" width="594" height="333"></a></p>
<ol>
<li><strong>Project Milestone<br /></strong>UXTreeList is a unique data control used to display self-referencing hierarchical data. You can use the HierarchicalCollectionView to transform your self-reference table into a hierarchical self-reference data.
<p>&nbsp;<br />UXTreeList combines all UXGrid features such as data editing, grouping and paging with UXTreeView’s expand/collapse functionality to perfectly present any hierarchical data.</p>
<p>In this sample, some features demonstrated are variety of columns type, common data manipulation and data editing that includes drag and drop to re-arrange your data. <a href="http://live.clientui.com/#/DataControls/UXTreeList" target="_blank">Explore the sample</a>.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/projectmilestone.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="ProjectMilestone" border="0" alt="ProjectMilestone" src="http://intersoftpt.files.wordpress.com/2012/06/projectmilestone_thumb.png" width="613" height="451"></a></p>
<li><strong>Chart of Account<br /></strong>
<p>UXTreeList supports load on demand scenario using MVVM pattern where only the root items are loaded initially. The children will be loaded on demand as users expanded the item for the first time. This feature is particularly useful to improve the overall performance when the assigned data source is relatively large.</p>
<p>In this sample, IsLoadOnDemand property is set to True in order to activate the load-on-demand feature. In this mode, a busy indicator will be automatically displayed in each expanded item during the loading progress. <a href="http://live.clientui.com/#/DataControls/UXTreeList/ChartOfAccount" target="_blank">Explore the sample</a>.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/chartofaccount.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="ChartOfAccount" border="0" alt="ChartOfAccount" src="http://intersoftpt.files.wordpress.com/2012/06/chartofaccount_thumb.png" width="607" height="348"></a></p>
<li><strong>Empty Row Visibility</strong><br />UXGridView lets you easily create beautiful data presentation with look and feel similar to popular desktop-based apps such as iTunes, Quick Books, or other business apps alike. With the new innovative rendering feature, UXGridView automatically fills the entire view port with alternating rows instead of leaving a large white empty space.
<p>&nbsp;<br />This sample demonstrates the empty rows visibility feature in UXGridView. When this featuere is enabled the UXGridView will render all the empty rows within the view port. You can also insert a new row from bottom when NewRowPosition is set to Bottom and CanUserAddRows is set to True. <a href="http://live.clientui.com/#/UXGridView/Customization/EmptyRowsVisibility" target="_blank">Explore the sample</a>.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/emptyrow.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="EmptyRow" border="0" alt="EmptyRow" src="http://intersoftpt.files.wordpress.com/2012/06/emptyrow_thumb.png" width="611" height="429"></a></p>
<li><strong>Bottom New Row Position<br /></strong>This new feature brings flexibility to the way users interact with the grid. Users can now rapidly add new items by clicking the bottom part of the grid, just like they would do in Excel. Activate this feature in your apps with a simple property set.
<p>In this sample, you can see there are new row position indicator on the last row in UXGridView. To go to the new row you can click the empty rows or use keyboard down on the last item. <a href="http://live.clientui.com/#/UXGridView/Editing/NewRowPosition" target="_blank">Explore the sample</a>.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/newrow.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="newrow" border="0" alt="newrow" src="http://intersoftpt.files.wordpress.com/2012/06/newrow_thumb.png" width="620" height="435"></a></p>
<li><strong>Sequence Column<br /></strong>Introducing the new UXGridViewSequenceColumn, you can now effortlessly display a column that automatically display sequential number to your data grid.
<p>&nbsp;<br />In this sample, we have UXGridViewSequenceColumn which is used to show the row index of the current display. Note that the sequence column can not be sorted and will always show the row index regardless of the sorting or filtering state. <a href="http://live.clientui.com/#/UXGridView/Customization/SequenceColumn" target="_blank">Explore the sample</a>.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/06/seq.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="seq" border="0" alt="seq" src="http://intersoftpt.files.wordpress.com/2012/06/seq_thumb.png" width="611" height="459"></a></p>
</li>
</ol>
<p>For more information about ClientUI, you can explore our <a href="http://www.clientui.com/" target="_blank">Live Samples</a> or read through our <a href="http://intersoftpt.com/Support/ClientUI/Documentation" target="_blank">Online Documentation</a>.</p>
<p>Feel free to download your copy <a href="http://www.clientui.com/download/">here</a>. And while waiting for the download, be sure to check out the complete what’s new list <a href="http://www.intersoftpt.com/2012/">here</a>. Existing customers with valid subscription can obtain the latest WebUI Studio from <a href="http://dev2.intersoftpt.com/">Developer Network</a>, under My Components shortcut.</p>
<p>If you have any questions regarding sales or licensing, you can directly email me at <a href="mailto:martin@intersoftpt.com">martin@intersoftpt.com</a>. Any comments or feedbacks are welcome.</p>
<p>Thank you and have a nice day.</p>
<p>Regards,<br />Martin</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2012/06/new-line-of-business-samples-in-clientui-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UXFileUpload: Store Uploaded Files in Database</title>
		<link>http://blog.intersoftsolutions.com/2012/04/uxfileupload-store-uploaded-files-in-database/</link>
		<comments>http://blog.intersoftsolutions.com/2012/04/uxfileupload-store-uploaded-files-in-database/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 04:06:00 +0000</pubDate>
		<dc:creator><![CDATA[yudhiy]]></dc:creator>
				<category><![CDATA[2011 R2]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[ClientUI]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[UXFileUpload]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=2667</guid>
		<description><![CDATA[Handling client files which are uploaded to a server is a common requirement for application. Files can be uploaded either to the FileSystem of your server or directly to the database as BLOB. However, there has been a lot of debate about the best way [...]]]></description>
				<content:encoded><![CDATA[<img width="421" height="269" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/image_thumb123.png" class="attachment-post-thumbnail wp-post-image" alt="image" style="float:right; margin:0 0 10px 10px;" /><p>Handling client files which are uploaded to a server is a common requirement for application. Files can be uploaded either to the FileSystem of your server or directly to the database as BLOB.</p>
<p>However, there has been a lot of debate about the best way to store the files. I’m sure there are many people who have strong favor for why one option is better than the other and vice versa.</p>
<p>So there must be interesting differences between the two solutions. Let’s have a brief comparison between these two options.</p>
<h2>FileSystem – Pros and Cons</h2>
<p>Storing the files on disk is much easier and simple to implement. Having the files in the filesystem <strong>allow accesing</strong> it from many different standard applications such FTP, web browser etc. and users as well, independent of access to the database itself etc.</p>
<p>Another advantage is that files on disk are <strong>easy to backup</strong>; you just copy the files to another location. This also makes it easier to do incremental backups; files that have already been backed up don’t need to be copied again.</p>
<p>Probably the <strong>most problematic issue</strong> is the loosely coupled nature of the files on disk as they have no strong relation with a record in the database. So, when you delete, say, a customer from the database, you may end up with an orphaned customer’s image/photo. There is no direct way to do a JOIN between the customer table and your images folder to determine what orphaned files you have left.</p>
<p>Nevertheless, to store uploaded files on disk, your web server needs <strong>permissions to write</strong> to the file system. This is easy to overcome by when you run your own server, but may prove to be more problematic in an ISP scenario.</p>
<h2>Database – Pros and Cons</h2>
<p>The loosely coupled nature of the files on disk problem will not happen when the uploaded files are stored in database. They have strong relation with a record in the database. It will automatically gets deleted when record of an employee is terminated.</p>
<p>Another advantage of storing files in a database is the fact that all data is contained in a single location. Make a backup of your database and you’re ready to go. No need to copy files, set up permission and so on.</p>
<p>Performance is probably one of the disadvantages of storing files in a database. Storing files in a database somehow degrading the performance as putting binary data into the database has obviously some overhead.</p>
<p>Another cons is that whenever you make a full backup of your database, all the files are included, whether they have been changed or not. If you copy your backups to a different machine or network for safety reasons, you need to move the entire backup file. With a file based solution, you can use diff programs that can determine which files have been changed since the last backup, and only download those.</p>
<p>Realizing that both methods have their pros and their cons, the question is: what to choose? Personally, due to its easier and simpler to be implemented, I’d prefer to store the uploaded files on FileSystem.</p>
<p>However, in this occasion, I will not discuss further on the pros and cons of the file storage matter. I’m going to present the solution on how to store the uploaded files of UXFileUpload ClientUI control to database.</p>
<h2>UXFileUpload Introduction</h2>
<p>UXFileUpload is a feature-rich file upload control supporting Silverlight 3, Silverlight 4, and WPF. It includes all standard features you expected in a file upload control, plus a multitude of innovative features that unique to UXFileUpload such as multiple upload worker process, comprehensive MVVM and commanding support, smart file chunk algorithm, very large file upload support, file-level cancellation, drag-and-drop files from operating system, and more.</p>
<p>Despite of the large number of features, UXFileUpload is designed for an ultimate ease-of-use. The simplest UXFileUpload control can be defined with only two properties set, the <em>ServiceUrl</em> and the <em>TargetFolder</em> property. You set the <em>ServiceUrl</em> property to a value that determines the absolute web address where the server-side handler is configured to accept the file upload requests. The <em>TargetFolder</em> determines where the files should be stored in the server.</p>
<p>ClientUI includes a built-in ASP.NET server-side handler that you can use to accept the file upload requests from the UXFileUpload control. When using the built-in server-side handler, you can set the <em>TargetFolder</em> to a relative path in your web server, for an instance, ~/Upload.</p>
<h2>Creating a Simple UXFileUpload Control</h2>
<p>The following code shows the most basic configuration of a UXFileUpload control.</p>
<p></p><pre class="crayon-plain-tag">&lt;Intersoft:UXFileUpload ServiceUrl="http://localhost:9041/UXFileUploadHandler.ashx"
                        TargetFolder="~/ClientBin/Assets/Documents" /&gt;</pre><p></p>
<p>You need to register the server-side upload handler in your ASP.NET web project in order for the UXFileUpload control to work properly. For more information configuring the server-side handler for the upload control, see <a href="http://www.intersoftpt.com/Support/ClientUI/Documentation/HowtoConfigureASPNETServersideHandlerforUXFileUpload.html">How-to: Configure ASP.NET Server-side Handler for UXFileUpload</a>.</p>
<p>When viewing the control in either design or runtime, you will find the results similar to the illustration in the following:</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/04/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb12.png" width="421" height="269"></a></p>
<p>With the upload control shown above, users can start to add files immediately by clicking the <strong>Add Files</strong> command in the toolbar and click on the <strong>Start Upload</strong> command to start uploading the selected files.</p>
<p>Once the <strong>Start Upload</strong> command is invoked, the file upload request will be handled by <em>UXFileUploadHandler.ashx</em> server-side upload handler. The uploaded files will be stored inside the <strong>Upload</strong> folder of the server.</p>
<p>In order to store the uploaded files to database instead of keep them in file system, we need to prepare following items.</p>
<ul>
<li>Add and configure database which will be used as file storage.
<li>Add and configure custom UXFileUpload handler. </li>
</ul>
<h2>Adding and Configuring Database</h2>
<p>A database, called <em>Files.mdf</em>, is added into the App_Data folder of the web project. This database has Files table which consist of following fields.</p>
<table border="1" cellspacing="0" cellpadding="2" width="359">
<tbody>
<tr>
<th valign="top" width="96">Column Name</th>
<th valign="top" width="123">Data Type</th>
<th valign="top" width="140">Allow Nulls</th>
</tr>
<tr>
<td valign="top" width="96">Id</td>
<td valign="top" width="123">uniqueidentifier</td>
<td valign="top" width="140">False</td>
</tr>
<tr>
<td valign="top" width="96">FileData</td>
<td valign="top" width="123">varbinary(MAX)</td>
<td valign="top" width="140">True</td>
</tr>
<tr>
<td valign="top" width="96">OriginalName</td>
<td valign="top" width="123">nvarchar(50)</td>
<td valign="top" width="140">False</td>
</tr>
<tr>
<td valign="top" width="96">DateCreated</td>
<td valign="top" width="123">datetime</td>
<td valign="top" width="140">False</td>
</tr>
</tbody>
</table>
<p>A Stored Procedure, <em>sprocFilesInsertSingleItem</em>, will be used to insert a single item of file into <em>Files.mdf</em> database.</p>
<p></p><pre class="crayon-plain-tag">INSERT INTO Files
(
	Id,
	FileUrl,
	FileData,
	OriginalName
)
VALUES
(
	@id,
	@FileUrl,
	@FileData,
	@originalName
)</pre><p></p>
<h2>Adding and Configuring Custom UXFileUpload Handler</h2>
<p>UXFileUpload implements a smart file chunk logic where multiple files can fit into a single upload request thus minimizing the client-server requests. With the smart file chunk logic, UXFileUpload allows you to upload very large files without have to worry about the performance and memory consumption in both client and server side. It is not necessary to change the maximum upload request length or other configuration in the server-side to accommodate the large files upload using the UXFileUpload control.</p>
<p>The built-in UXFileUpload server handler is designed with a great level of customizability, allowing you to inherit the UXFileUploadHandler class and override the properties as necessary. We can also customize the upload post processing logic, by overriding the provided methods.</p>
<p>We will create a custom UXFileUpload handler that will store the uploaded files into the database by overriding the <em>OnUploadCompleted</em> method. Within this method, we can find all the information we need, such as: the number of uploaded files; the file path of uploaded files; saved name of the uploaded files; etc. In <em>OnUploadCompleted</em> we have files that has been completely uploaded. This is important to ensure that there is no file problem such as corrupted files or incomplete files during the saving of the files to the database.</p>
<p>Generally, the custom handler will process each of uploaded files and do the following:</p>
<ul>
<li>Read and manipulate the file using <em>FileStream</em> class.
<li>Invoke <em>sprocFilesInsertSingleItem</em> stored procedure to store the file on <em>Files.mdf </em>database.
<li>Delete the specified file from the location specified in <em>TargetFolder</em> property of UXFileUpload. </li>
</ul>
<p>Open the UXFileUpload project and add a class library project, named as ExtendedUXFileUploadHandler.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/04/image51.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://intersoftpt.files.wordpress.com/2012/04/image51_thumb.png" width="640" height="443"></a></p>
<p>Add the following code into the <em>DatabaseFileUploadHandler.cs</em> file.</p>
<p></p><pre class="crayon-plain-tag">public class DatabaseFileUploadHandler : UXFileUploadHandler
{
    protected override void OnUploadCompleted(List&lt;FileUploadInfoResponse&gt; uploadedFiles)
    {
        if (uploadedFiles.Count &gt; 0)
        {
            int FilesNumber = uploadedFiles.Count;

            for (int i = 0; i &lt; FilesNumber; i++)
            {
                byte[] fileData = ReadFile(uploadedFiles[i].TargetFilePath);
                string originalName = uploadedFiles[i].SavedName;

                using (SqlConnection mySqlConnection = new SqlConnection(
                      @"Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Files.mdf;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Integrated Security=True;Connect Timeout=30;User Instance=True"))
                {
                    // Set up the Command object
                    SqlCommand myCommand = new SqlCommand("sprocFilesInsertSingleItem", mySqlConnection);
                    myCommand.CommandType = CommandType.StoredProcedure;

                    // Set up the ID parameter
                    SqlParameter prmId = new SqlParameter("@id", SqlDbType.UniqueIdentifier);

                    prmId.Value = uploadedFiles[i].ID;
                    myCommand.Parameters.Add(prmId);

                    // Set up the FileData parameter
                    SqlParameter prmFileData = new SqlParameter("@fileData ", SqlDbType.VarBinary);

                    prmFileData.Value = fileData;
                    prmFileData.Size = fileData.Length;
                    myCommand.Parameters.Add(prmFileData);

                    // Set up the OriginalName parameter
                    SqlParameter prmOriginalName = new SqlParameter("@originalName", SqlDbType.NVarChar, 50);
                    prmOriginalName.Value = uploadedFiles[i].SavedName;
                    myCommand.Parameters.Add(prmOriginalName);

                    // Execute the command, and clean up.
                    mySqlConnection.Open();
                    bool result = myCommand.ExecuteNonQuery() &gt; 0;
                    mySqlConnection.Close();
                }

                File.Delete(uploadedFiles[i].TargetFilePath);
            }
        }            

        base.OnUploadCompleted(uploadedFiles);
    }

    private static byte[] ReadFile(string filePath)
    {
        byte[] buffer;
        FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);

        try
        {
            int length = (int)fileStream.Length; // get file length
            buffer = new byte[length];           // create buffer
            int count;                           // actual number of bytes read
            int sum = 0;                         // total number of bytes read

            // read until Read method returns 0 (end of the stream has been reached)
            while ((count = fileStream.Read(buffer, sum, length - sum)) &gt; 0)
            {
                sum += count; // sum is a buffer offset for next reading
            }
        }
        finally
        {
            fileStream.Close();
        }

        return buffer;
    }
}</pre><p></p>
<p>The <em>ReadFile</em> function will reads the source file into a byte array. The <em>Read</em> method of <em>FileStream</em> object returns zero only after reaching the end of the stream. Otherwise, <em>Read</em> always reads at least one byte from the stream before returning. Finally, close the current stream and releases any resources associated with the current stream when <em>Read</em> method returns zero.</p>
<p>After completing the read process and set up the required parameter, <em>fileData</em> byte array will then be inserted into <em>Files</em> table by invoking the <em>sprocFilesInsertSingleItem</em> stored procedure.</p>
<p>Finally, delete the uploaded file from the specified path after execute the stored procedure.</p>
<p>Before running the solution, build the project and add the reference of <strong>ExtendedUXFileUploadHandler.dll</strong> into the web project. Then re-define the handler in Web.Config file into the following.</p>
<p></p><pre class="crayon-plain-tag">&lt;configuration&gt;
  ...
  &lt;system.web&gt;
        &lt;compilation debug="true" targetFramework="4.0" /&gt;
      &lt;httpHandlers&gt;
        &lt;add verb="*" path="UXFileUploadHandler.ashx"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="ExtendedUXFileUploadHandler.DatabaseFileUploadHandler, ExtendedUXFileUploadHandler"/&gt;
      &lt;/httpHandlers&gt;
    &lt;/system.web&gt;
  &lt;system.webServer&gt;
    &lt;handlers&gt;
      &lt;add name="UXFileUpload" verb="*" path="UXFileUploadHandler.ashx"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="ExtendedUXFileUploadHandler.DatabaseFileUploadHandler, ExtendedUXFileUploadHandler" /&gt;      
    &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  ...
&lt;/configuration&gt;</pre><p></p>
<p>Save all the changes and run the project.</p>
<p>Add files to be uploaded and click <strong>Start Upload</strong>. After the uploading process completed, the uploaded files is no longer available in the <em>TargetFolder</em> location. The file is now stored in database.</p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/04/image11.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://intersoftpt.files.wordpress.com/2012/04/image1_thumb.png" width="400" height="350"></a></p>
<p><a href="http://intersoftpt.files.wordpress.com/2012/04/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb11.png" width="640" height="87"></a></p>
<p>In this post, we have learnt how to store uploaded files of UXFileUpload to database by overriding the UXFileUpload handler.</p>
<p>Click <a href="http://www.intersoftpt.com/tdn/downloads/BindUplodedFilesUsingMVVMPattern.zip">here</a> to download the sample project and feel free to drop me a line in the comment box if you find that this post useful, or have any questions and feedback regarding this topic.</p>
<p>Regards,<br />Yudi Ariawan</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2012/04/uxfileupload-store-uploaded-files-in-database/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Create Rich Outlook Style Silverlight Application in Minutes</title>
		<link>http://blog.intersoftsolutions.com/2012/04/create-rich-outlook-style-silverlight-application-in-minutes/</link>
		<comments>http://blog.intersoftsolutions.com/2012/04/create-rich-outlook-style-silverlight-application-in-minutes/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 10:04:52 +0000</pubDate>
		<dc:creator><![CDATA[yudhiy]]></dc:creator>
				<category><![CDATA[2011 R2]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[ClientUI]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Office Ribbon]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[UXRibbon]]></category>

		<guid isPermaLink="false">https://intersoftpt.wordpress.com/?p=2641</guid>
		<description><![CDATA[Recently I was assigned to create a simple Silverlight project that shows a list of data with full editing support. The first thing that comes to my mind is using the ClientUI project template as a first step to start working on this task. After [...]]]></description>
				<content:encoded><![CDATA[<img width="466" height="270" src="http://blog.intersoftsolutions.com/wp-content/uploads/2014/09/image_thumb39-604x350.png" class="attachment-post-thumbnail wp-post-image" alt="" style="float:right; margin:0 0 10px 10px;" /><p>Recently I was assigned to create a simple Silverlight project that shows a list of data with full editing support. The first thing that comes to my mind is using the ClientUI project template as a first step to start working on this task.</p>
<p>After spending about 30 minutes trying all the project templates that come with Intersoft WebUI Studio 2011 R2 SP1, I decided to start the project using Intersoft ClientUI Ribbon Application template. This project template allows the creation of rich Silverlight application with rich Ribbon interface and integrated navigation interfaces.</p>
<p>Intersoft ClientUI Ribbon Application template is ideal to build business applications with relatively large modules and features. The template ships with predefined MVVM infrastructure that demonstrates how to use UXRibbonBar as a command placeholder that dynamically change its content based on the active module. It also includes fully-functional MVVM examples such as Mail and Calendar which are implemented with the advanced data controls available in ClientUI.</p>
<p>Building rich application using this Ribbon project template is easy and straightforward. In this blog post, I’ll share some of my experiences building the project such as adding the navigation, customizing the ribbon through XML configuration file, and drop-in the data grid to display data.</p>
<p>Let’s get started!</p>
<h2>Creating a new project from the Ribbon Application project template</h2>
<p>We’ll start by creating a new Silverlight project using Intersoft ClientUI Ribbon Application project template. This project template is available after install the Premier edition or Intersoft WebUI Studio 2011 R2 (or newer) for Silverlight and WPF. To create a new Intersoft ClientUI Ribbon Application project, open Visual Studio and select File &gt; New &gt; Project… (or press Ctrl+Shift+N) from the menu bar. Select Intersoft ClientUI Ribbon Application from New Project window. Enter the appropriate details to create the new application project.</p>
<p>One nice feature of Intersoft project template on New Project window of Visual Studio is that you can have the Intersoft project template grouped under Intersoft Solutions node of Installed Templates tree view.</p>
<p><img alt="Intersoft ClientUI Ribbon Application Project Template" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb.png" width="642" height="411"></p>
<p>The project template contains several predefined configuration, assembly references, and code files such as Assets, Factory, Selectors and several XAML files. Click <a href="http://www.intersoftpt.com/Support/ClientUI/Documentation/WalkthroughCreateANewSilverlightRibbonApplicationFromProjectTemplate.html">here</a> to learn more about the structure of this project template.</p>
<p>When you run the project for the first time, you’ll see a fully-functional user interface such as shown below.</p>
<p><img alt="Project's User Interface" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb1.png" width="550" height="482"></p>
<h2>Creating Inventory UXRibbon Structure</h2>
<p>I’m going to add a new module which will show list of products. The module will have its own ribbon bar control which employs three buttons: add new data; edit selected item; and delete selected item.</p>
<p><img alt="Inventory Module Ribbon Button" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb2.png" width="642" height="70"></p>
<p>Three image files are added into the [SilverligthProject]AssetsImagesInventory folder as the icon for each of the button.</p>
<p></p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;RibbonBar Name="Inventory"&gt;
  &lt;RibbonTab Header="Home" IsSelected="True"
             ResizeOrder=""
             KeyTipAccessText="H"&gt;
    &lt;RibbonTabGroup Name="Edit" Header="Products" MinimumSize="Large" IsCollapsible="false"
                    Icon="/ClientUIRibbon1;component/Assets/Images/Inventory/Inventory.png"&gt;
      &lt;RibbonButton Content="Add New" MinimumSize="Large" TooltipHeader="New Item" TooltipContent="Create a New Item."
                    LargeIcon="/ClientUIRibbon1;component/Assets/Images/Inventory/AddExistingStandard_32.png"/&gt;
      &lt;RibbonButton Content="Edit" MinimumSize="Large" TooltipHeader="Edit Selected Item" TooltipContent="Edit Selected Item."
                    LargeIcon="/ClientUIRibbon1;component/Assets/Images/Inventory/Edit32.png"/&gt;
      &lt;RibbonButton Content="Delete" MinimumSize="Large" TooltipHeader="Delete Selected Item" TooltipContent="Delete Selected Item."
                    LargeIcon="/ClientUIRibbon1;component/Assets/Images/Inventory/Delete.png"/&gt;
    &lt;/RibbonTabGroup&gt;
  &lt;/RibbonTab&gt;

&lt;/RibbonBar&gt;</pre><p></p>
<p>Instead of declaring the ribbon structure directly in the xaml page, the ribbon structure is defined in an xml file, RibbonInventoryData.xml. The file is located inside the [SilverlightProject]AssetsData folder.</p>
<p>RibbonFactory.cs class will read each element, attributes of the xml file; parse them to the appropriate object; and create the ribbon to be displayed.</p>
<p>Once the ribbon structure is configured, we need to initialize the ribbon data source and register the Inventory module so that the ribbon tab will be dynamically updated when user select Inventory module.</p>
<p>To initialize the ribbon data source, find InitializeRibbonBar() method in the RibbonPageViewModel.cs class and add a line as shown in the following code. *The class can be found in [SilverlightProject]ViewModels folder.</p>
<p></p><pre class="crayon-plain-tag">private void InitializeRibbonBar()
{
    // Initializes application menu
    this.RibbonApplicationMenu = RibbonFactory.CreateMenu(RibbonDataFolder + "RibbonBarData.xml");

    // Initializes ribbon data sources
    this.RibbonData = new Dictionary&lt;ModuleType, string&gt;();
    this.RibbonData.Add(ModuleType.Overview, "RibbonOverviewData.xml");
    ...
    this.RibbonData.Add(ModuleType.Inventory, "RibbonInventoryData.xml");
}</pre><p></p>
<p>Before running the project and showing the ribbon structure of Inventory module, we need to register the Inventory module in the UpdateRibbonTab method. UpdateRibbonTab is the method that will be invoked when users select a module.</p>
<p></p><pre class="crayon-plain-tag">internal void UpdateRibbonTab(ModuleType moduleType, object context)
{
    ...

    switch (moduleType)
    {
        case ModuleType.Calendar:
        case ModuleType.Contacts:
        case ModuleType.Inventory:
        case ModuleType.Mail:
            this.RibbonContextualGroups = RibbonFactory.CreateRibbonContextualTabGroups(RibbonDataFolder + this.RibbonData[moduleType]);
            this.RibbonTabs = RibbonFactory.CreateRibbonTabs(RibbonDataFolder + this.RibbonData[moduleType], context);
            break;

        default:
            this.RibbonTabs = RibbonFactory.CreateRibbonTabs(RibbonDataFolder + this.RibbonData[ModuleType.Overview], context);
            break;
    }

    this.ActiveModule = moduleType;
}</pre><p></p>
<p>Save all the changes and run the Silverlight application project<strong>.</strong></p>
<p>The ribbon structure for Inventory module has been successfully added. When users click/select the Inventory module from the navigation pane, the Add New button; Edit button; and Delete button will be shown.</p>
<p><img alt="UXRibbon for Inventory Module" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb3.png" width="642" height="383"></p>
<h2>Displaying The Product List with UXGridView</h2>
<p>In this part, we are going to display a list of products. The list will be presented in an UXGridView control.</p>
<p>In this project, UXGridView is bound to WCF RIA Services. In this post, I will not describe in detail about how to configure the application to become WCF RIA Services-enabled; creating the data model; etc. I’d like to suggest you to refer to Intersoft ClientUI MVVM Data Application (WCF RIA SP1) project template. To learn more, see <a href="http://www.intersoftpt.com/Support/ClientUI/Docs/WalkthroughCreateNewIntersoftClientUIMVVMDataApplicationWCFRiaSP1.html">Walkthrough: Create New Intersoft ClientUI MVVM Data Application (WCF RIA SP1) Template</a>.</p>
<p>Once the data repository of Products is completely added, Add UXGridView control and bind the ItemsSource property with Items property from ProductsViewModel; and bind each column of the UXGridView to their corresponding property of ProductsViewModel respectively.</p>
<p></p><pre class="crayon-plain-tag">&lt;Intersoft:UXGridView Intersoft:DockPanel.IsFillElement="True" ItemsSource="{Binding Path=Items}"
                        AutoGenerateColumns="False"&gt;
    &lt;Intersoft:UXGridView.Columns&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Category ID" Binding="{Binding CategoryID}"/&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Product ID" Binding="{Binding ProductID}"/&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Product Name" Binding="{Binding ProductName}"/&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Unit Price" Binding="{Binding UnitPrice}"/&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Units In Stock" Binding="{Binding UnitsInStock}"/&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Units On Order" Binding="{Binding UnitsOnOrder}"/&gt;
        &lt;Intersoft:UXGridViewTextColumn Header="Quantity Per Unit" Binding="{Binding QuantityPerUnit}"/&gt;
    &lt;/Intersoft:UXGridView.Columns&gt;
&lt;/Intersoft:UXGridView&gt;</pre><p></p>
<p>Save all the changes and run the project.</p>
<p><img alt="UXGridView in Inventory Module" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb4.png" width="642" height="383"></p>
<p>The Inventory module now has had a ribbon structure and will display a list of product in the ContentFrame.</p>
<h2>Adding Commanding and Enabling/Disabling UXRibbon Button Based on UXGridView Selected Item.</h2>
<p>In this part, I’d like to set the enable/disable state of each ribbon button based on the selected item of UXGridView. By default, the Add New UXRibbonButton is enabled since user should be able to add new item at any time. When no item is selected in UXGridView, Edit and Delete button should be disabled. They will be enabled when item(s) are selected.</p>
<p>In UXGridView, when a row is selected, the SelectedItem property will be automatically synchronized. I can bind this property to my ViewModel to capture the currently selected item. This property is then converted to a Visible/Collapsed and then consumed by IsEnabled property of UXRibbon button to determine whether the UXRibbon button is enabled or not.</p>
<p>Several questions arise when I started to check the feasibility to implement this approach.</p>
<ul>
<li>The Inventory.xaml page and the UXRibbon are located in different view. Each of them has their own ViewModel. Implementing converter seems not as easy as I thought earlier.
<li>The xml file of ribbon structure is processed by RibbonFactory.cs class by implementing parser. I need to ensure whether the ribbon button parser is equipped with binding parser or not. </li>
</ul>
<p>I’m pretty sure there must be an elegant solution for a simple scenario such as this. So I decided to explore this project and hope to find an example that can be applied to my scenario.</p>
<p>After spending about 15 minutes exploring the project, clues are spotted when Mail module is opened. Some of the ribbon buttons are disabled when no message is selected.</p>
<p>This is exactly what I’m looking for!</p>
<p>It turns out that DelegateCommand play an important role in such scenario as shown in the Mail module. ClientUI provides DelegateCommand, a specialized command object that can be used to handle a delegate directly in the view model, and still can be bound to the view through binding. Furthermore, the DelegateCommand takes advantage of the routed command concept in which the IsEnabled state of the command sources will be automatically synchronized depending on whether the command can execute.</p>
<p>Many thanks to ClientUI development team who has extended the commanding framework to support MVVM through built-in DelegateCommand class. Not only this, they also have made this project template brilliantly. I mean it and don’t intend to exaggerate about what I say. Building Silverlight application based on Intersoft’s project template is considerably easy, even for beginners. I started to learn the implementation of DelegateCommand on Mail module and reset the plan to implement this scenario to be as follow.</p>
<p>There are three UXRibbon button: Add New; Edit; and Delete. Each button is bound to the AddAction; EditAction; and DeleteAction DelegateCommand respectively.</p>
<p>RibbonInventoryData.xml</p>
<p></p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;RibbonBar Name="Inventory"&gt;
  &lt;RibbonTab ...&gt;
    &lt;RibbonTabGroup Name="Edit" ...&gt;
      &lt;RibbonButton Content="Add New" MinimumSize="Large" TooltipHeader="New Item" TooltipContent="Create a New Item."
                    LargeIcon="/ClientUIRibbon1;component/Assets/Images/Inventory/AddExistingStandard_32.png"
                    Command="{Binding AddAction}" CommandParameter="AddNew"/&gt;
      &lt;RibbonButton Content="Edit" MinimumSize="Large" TooltipHeader="Edit Selected Item" TooltipContent="Edit Selected Item."
                    LargeIcon="/ClientUIRibbon1;component/Assets/Images/Inventory/Edit32.png"
                    Command="{Binding EditAction}" CommandParameter="Edit"/&gt;
      &lt;RibbonButton Content="Delete" MinimumSize="Large" TooltipHeader="Delete Selected Item" TooltipContent="Delete Selected Item."
                    LargeIcon="/ClientUIRibbon1;component/Assets/Images/Inventory/Delete.png"
                    Command="{Binding EditAction}" CommandParameter="Delete"/&gt;
    &lt;/RibbonTabGroup&gt;
  &lt;/RibbonTab&gt;
  ...  
&lt;/RibbonBar&gt;</pre><p></p>
<p>ProductsViewModel.cs</p>
<p></p><pre class="crayon-plain-tag">public class ProductsViewModel : EditableGridViewModelBase&lt;Product&gt;
{
    public ProductsViewModel()
    {
        this.AddAction = new DelegateCommand(AddCommandAction, CanAddAction);
        this.EditAction = new DelegateCommand(EditCommandAction, CanEditAction);
        this.DeleteAction = new DelegateCommand(DeleteCommandAction, CanDeleteAction);
    }

    public DelegateCommand AddAction
    {
        get;
        set;
    }

    public DelegateCommand EditAction
    {
        get;
        set;
    }

    public DelegateCommand DeleteAction
    {
        get;
        set;
    }

    ...

    private bool CanAddAction(object obj)
    {
        //this method validate whether or not AddNew button is active
        //In this sample, I will keep this button to be always active
        return true;
    }

    private bool CanEditAction(object obj)
    {
        if (this.SelectedProductItem != null)
            return true;
        return false;
    }

    private bool CanDeleteAction(object obj)
    {
        if (this.SelectedProductItem != null)
            return true;
        return false;
    }

    private void AddCommandAction(object obj)
    {
        MessageBoxServiceProvider.Show("add new row is performed", "Information",
                    Intersoft.Client.UI.Aqua.UXDesktop.MessageBoxButton.OK, Intersoft.Client.UI.Aqua.UXDesktop.MessageBoxImage.Information, null);
    }

    private void EditCommandAction(object obj)
    {
        MessageBoxServiceProvider.Show("edit selected row is performed", "Information",
                    Intersoft.Client.UI.Aqua.UXDesktop.MessageBoxButton.OK, Intersoft.Client.UI.Aqua.UXDesktop.MessageBoxImage.Information, null);
    }

    private void DeleteCommandAction(object obj)
    {
        MessageBoxServiceProvider.Show("delete selected row is performed", "Information",
            Intersoft.Client.UI.Aqua.UXDesktop.MessageBoxButton.OK, Intersoft.Client.UI.Aqua.UXDesktop.MessageBoxImage.Information, null);
    }
}</pre><p></p>
<p><img alt="Binding Command to UXRibbonButton" src="http://intersoftpt.files.wordpress.com/2012/04/image_thumb5.png" width="638" height="482"></p>
<p>In the next series of my blog post, I will add a final touch to this Ribbon application by displaying detail information of data (for adding and editing operation) in a form.</p>
<h2>Download Sample Code</h2>
<p>For your reference, the demo project can be downloaded <a href="http://www.intersoftpt.com/tdn/downloads/ClientUIRibbon1.zip">here</a>.</p>
<p>I hope that this project will help you to prepare a simple demo project and provide you with insights about how easy to start developing Silverlight project using Intersoft Silverlight project template.</p>
<p>I&#8217;d love to hear your feedback so be sure to drop your comments in the box below.</p>
<p>Regards,<br />Yudi</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.intersoftsolutions.com/2012/04/create-rich-outlook-style-silverlight-application-in-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
