<?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>xaml ninja &#187; Blend</title>
	<atom:link href="http://blogs.xamlninja.com/tag/blend/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.xamlninja.com</link>
	<description>xaml ninja moves</description>
	<lastBuildDate>Tue, 10 Jan 2012 19:46:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Expression Blend 4 does not start after installing the NET Framework 4.5 Developer Preview</title>
		<link>http://blogs.xamlninja.com/blend/expression-blend-4-does-not-start-after-installing-the-net-framework-4-5-developer-preview</link>
		<comments>http://blogs.xamlninja.com/blend/expression-blend-4-does-not-start-after-installing-the-net-framework-4-5-developer-preview#comments</comments>
		<pubDate>Mon, 03 Oct 2011 08:53:44 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Blend]]></category>

		<guid isPermaLink="false">http://blogs.xamlninja.com/?p=736</guid>
		<description><![CDATA[Over the last couple of days I have been trying out different combinations for app development on the Metro/WinRT platform and one of these involved installing VS 2011 Ultimate on to my main box that runs Win 7. Unfortunately Blend and the VS 11 Ultimate Developer Preview bits don&#8217;t play together out of the box. [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last couple of days I have been trying out different combinations for app development on the Metro/WinRT platform and one of these involved installing VS 2011 Ultimate on to my main box that runs Win 7. Unfortunately Blend and the VS 11 Ultimate Developer Preview bits don&#8217;t play together out of the box. This is a known issue, and following the steps below will fix the issue. </p>
<p>You can Copy and Paste the commands below.</p>
<p>Open a command prompt window with administrative privileges and then run the following commands:</p>
<p>%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall &#8220;%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Framework.dll&#8221;</p>
<p>%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall &#8220;%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Blend.dll&#8221;</p>
<p>%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall &#8220;%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Project.dll&#8221;</p>
<p>If you have installed Expression Blend 4 SP1, you must also uninstall the native image of the Microsoft.Expression.WindowsPhone.dll file from the cache by using the following command:</p>
<p>%windir%\Microsoft.NET\Framework\v4.0.30319\ngen uninstall &#8220;%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.WindowsPhone.dll&#8221;</p>
<p>&nbsp;</p>
<p>What&#8217;s also rather interesting is that when installing VS11 Ultimate on to a Win 7 box you are not able to create Metro apps.</p>
<p>Big thanks to Steve White and Joanna Mason from the Expression Blend team for helping to resolve this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.xamlninja.com/blend/expression-blend-4-does-not-start-after-installing-the-net-framework-4-5-developer-preview/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uk tech.days 2011</title>
		<link>http://blogs.xamlninja.com/silverlight/uk-tech-days-2011</link>
		<comments>http://blogs.xamlninja.com/silverlight/uk-tech-days-2011#comments</comments>
		<pubDate>Mon, 23 May 2011 12:31:12 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[uktechdays]]></category>
		<category><![CDATA[Xaml]]></category>

		<guid isPermaLink="false">http://blogs.xamlninja.com/?p=464</guid>
		<description><![CDATA[This week Ollie and I will presenting at the UK tech.days happening in the Fulham, London. Our first session will be all about building Data Data Intensive apps for WP7 and we are really looking forward to talking to you about what we have learnt building these types of applications. We are also going to [...]]]></description>
			<content:encoded><![CDATA[<p>This week <a href="http://awkwardcoder.blogspot.com/" target="_blank">Ollie </a>and I will presenting at the UK <a href="http://uktechdays.cloudapp.net/home.aspx">tech.days</a> happening in the Fulham, London.</p>
<p>Our first session will be all about building <a href="http://uktechdays.cloudapp.net/techdays-live/windows-phone-1-state-of-the-nation.aspx" target="_blank">Data Data Intensive apps for WP7</a> and we are really looking forward to talking to you about what we have learnt building these types of applications. We are also going to show off bits from the WP7 Contrib that help to make building these types of applications easier. It&#8217;s going to be a demo packed session so hold on for a rollercoaster ride. We are making avaliable all our demos before the session so if you are attending and interested you can download these from the skydrive link at the bottom of the post.</p>
<p>My other session obviously will be about using Blend =P  and the title of the session is aptly named <a href="http://uktechdays.cloudapp.net/techdays-live/building-rich-client-applications.aspx">&#8220;Expression Blend for Silverlight Developers&#8221;</a>.</p>
<p>The session is broken down into 3 sub sections; designer developer collaboration; Blend quick fire tips; and the main part, building out an app from a Adobe Photoshop/Illustrator visual design into a functional Silverlight app. This session is aimed particularly at developers who are just starting out with Blend, however even if you have been using Blend for a while there should be plenty of refreshers.</p>
<p>Now, I had thought about doing</p>
<p><em> “… this is how I create a button in Blend, and oh look I can make it into a circle and bounce across the screen…”</em></p>
<p>as much as I love attending these sessions and love the buzz afterwards sometimes it can be difficult to relate the content to a problem you may currently be working on.</p>
<p>Up on skydrive you will find; the .psd file I am going to use; an unstyled version; and a completed version that is styled. There is still plenty more to do so the scope is open and hopefully you will be able to use this as a reference point for future apps that you build. Therefore, I thought that it would be an interesting idea to see how attendees if they so wished can use the session as a hands-on Blend training hour, and if you want to participate then you can. Otherwise you can sit back and watch how we build a static vector graphic into a functioning app.</p>
<p>If you are planning on attending and would like me to cover off anything in particular I will do my best to make it happen, otherwise I would be more than happy to chat during the event, if you can bring code or have a scenario that would really help me understand the context of your questions.</p>
<p>You can find all of the goodies up on the sky drive folder.</p>
<p>See you there!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.xamlninja.com/silverlight/uk-tech-days-2011/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WP7Contrib &#8211; Page Transitions and Navigation Service</title>
		<link>http://blogs.xamlninja.com/blend/wp7contrib-page-transitions-and-navigation-service</link>
		<comments>http://blogs.xamlninja.com/blend/wp7contrib-page-transitions-and-navigation-service#comments</comments>
		<pubDate>Mon, 21 Mar 2011 15:33:27 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[WP7Contrib]]></category>
		<category><![CDATA[Xaml]]></category>

		<guid isPermaLink="false">http://blogs.xamlninja.com/?p=433</guid>
		<description><![CDATA[I finally got around to updating the page transistions in wp7 contrib last week, its something that has been on my list for awhile. For a complete sample project check out the sample in the spikes folder where you can also find lots of other samples illustrating other tennants of the contrib. The transitions used [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to updating the page transistions in <a href="http://wp7contrib.codeplex.com/">wp7 contrib</a> last week, its something that has been on my list for awhile. For a complete sample project check out the sample in the spikes folder where you can also find lots of other samples illustrating other tennants of the contrib.</p>
<p>The transitions used in the <a href="http://wp7contrib.codeplex.com/">WP7C </a>are based around the great work of <a href="http://blogs.claritycon.com/kevinmarshall/author/kmarshall/">Kevin Marshall</a> who originally created the <a href="http://blogs.claritycon.com/blog/2010/10/13/wp7-page-transitions-sample/">transitions</a>, we like them becuase they are lighter on memory usage and slightly faster when compared to the page transitions found in the WP7 toolkit. Now that is not too say I dislike the transitions in the toolkit, I actually really like them mainly because we have the ability to define these transitions in Xaml and hopefully there will be some future design-time support in Blend where we could run these transitions. Xaml support for the transitions is definately on the vNext list for the WP7C as we believe its important for designers to able to change, apply and understand the different transitions that are available.</p>
<p>When comparing implementation details, the toolkit uses a custom Frame called a Transition Frame; and WP7C does this at a page level all the pages in your app have to sub class the Animated Base Page. Other differences include; the toolkit uses a Render Transform and WP7C uses Composite Transform; the WP7C uses the XamlReader.Load to setup the storyboards, however the toolkit has specific loose Xaml files that contain the storyboards.</p>
<p>So the new page transitions includes the different Rotate permutations for your page transitions, I also added in some new slide and fade transitions. You can play with these and all the other different transitions by downloading the sample app.</p>
<p>The other thing that I decided to add into the app was a very simple implementation of the WP7C navigation service. Page transitions and navigation are interconnected, when you navigate to a page you want to execute a transition between the current page and the new page, this is approapiate when going forwards or backwards. Normally we would wire up the WP7C Navigation Service in the bootstrapper of our app and use a DI framework to new this up. In order to keep everything super simple I am using the interface and manually newing up an instance, also note that I am not using a View Model this is simply to show the flexibility of the WP7C Navigation Service.</p>
<pre class="brush: csharp">
private WP7Contrib.Services.Navigation.INavigationService navigationService;

public MainPage()
{
        InitializeComponent();

       AnimationContext = LayoutRoot;
       this.navigationService = new WP7Contrib.Services.Navigation.ApplicationFrameNavigationService(
                                   ((App)Application.Current).RootFrame);
}
</pre>
<p>Notice how we grab the RootFrame and pass this in to the constructor of the WP7C Navigation Service the same code can be used in a bootstrapper. When using the WP7C transitions there is no requirement for us to change the base class of the frame in the App&#8217;s Initalize Phone App handler like we would do when using the toolkit.</p>
<pre class="brush: csharp">
private void InitializePhoneApplication()
{
    if (this.phoneApplicationInitialized)
    {
        return;
    }

    // Create the frame but don&#039;t set it as RootVisual yet; this allows the splash
    // screen to remain active until the application is ready to render.
    this.RootFrame = new TransitionFrame();
    this.RootFrame.Navigated += this.CompleteInitializePhoneApplication;

    // Handle navigation failures
    this.RootFrame.NavigationFailed += RootFrame_NavigationFailed;

    // Ensure we don&#039;t initialize again
    this.phoneApplicationInitialized = true;
}
</pre>
<p>Instead we need to hang all our pages from the Animated Base Page, pay close attention to; the constructor where we assign the Animated Context of our base page to the LayoutRoot of our page; and the overridden Get Animation where we are deciding which transitions to fire based on the Animation Type.</p>
<pre class="brush: csharp">
namespace PageTransition
{
    using System;

    using WP7Contrib.View.Transitions.Animation;

    public partial class Slide : AnimatedBasePage
    {
        public Slide()
        {
            InitializeComponent();

            AnimationContext = LayoutRoot;
        }

        protected override AnimatorHelperBase GetAnimation(AnimationType animationType, Uri toOrFrom)
        {
            if (animationType == AnimationType.NavigateForwardOut)
            {
                return new SlideLeftFadeOutAnimator { RootElement = LayoutRoot };
            }

            if (animationType == AnimationType.NavigateBackwardOut)
            {
                return new SlideRightFadeOutAnimator { RootElement = LayoutRoot };
            }

            if (animationType == AnimationType.NavigateForwardIn)
            {
                return new SlideLeftFadeInAnimator { RootElement = LayoutRoot };
            }

            return new SlideRightFadeInAnimator { RootElement = this.LayoutRoot };};
        }
    }
}
</pre>
<p>For completeness I have covered off the different permutations of Navigating forward or backward. The implemented page transitions have a corresponding Animator which makes it straightforward to implement the type of animation that you require. And that is everything you need in order to get page transitions working in your app. Once you have implemented the transitions you want then its a fairly simple task of using the WP7C Navigation Service to navigate to a page in your app.</p>
<pre class="brush: csharp">
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (AnimationList.SelectedIndex != -1)
    {
        switch (AnimationList.SelectedIndex)
        {
            case 0:
                this.navigationService.Navigate(new Uri(&quot;/View/Turnstile.xaml&quot;, UriKind.Relative));
                break;

            case 1:
                this.navigationService.Navigate(new Uri(&quot;/View/TurnstileFeather.xaml&quot;, UriKind.Relative));
                break;

            case 2:
                this.navigationService.Navigate(new Uri(&quot;/View/Continuum.xaml&quot;, UriKind.Relative));
                break;

            case 3:
                //slide right
                this.navigationService.Navigate(new Uri(&quot;/View/SlideRight.xaml&quot;, UriKind.Relative));
                break;

        }
    }
}
</pre>
<p>And we are done!</p>
<p>Couple of things to watch out for when implementing the page transitions</p>
<ol>
<li>Make sure that you have the correct base url in you WMAppManifest.xml.<br />
It should look something like this</p>
<pre class="brush: xml">
&lt;Tasks&gt;
      &lt;DefaultTask  Name =&quot;_default&quot; NavigationPage=&quot;View/MainPage.xaml&quot;/&gt;
    &lt;/Tasks&gt;
</pre>
<p>Even if you have a sub folder which contains your Views
</li>
<li>If you have already overriden the OnBackKeyPress handler remember to call the base implementation</li>
</ol>
<p>If you have created transitions and happy to share or have ideas for ones you would like to see then please contact me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.xamlninja.com/blend/wp7contrib-page-transitions-and-navigation-service/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MVVM, design time data, and Blendability</title>
		<link>http://blogs.xamlninja.com/silverlight/mvvm-design-time-data-and-blendability</link>
		<comments>http://blogs.xamlninja.com/silverlight/mvvm-design-time-data-and-blendability#comments</comments>
		<pubDate>Fri, 02 Oct 2009 08:44:15 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Ninject]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Xaml]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blogs.xamlninja.com/?p=34</guid>
		<description><![CDATA[With the introduction of design time data support in Blend I thought that I would try and take advantage of using design time data and MVVM. For a while now I have been using Ninject, with a Service Locator Pattern to provide the ability to build WPF and Silverlight apps in an MVVM pattern where [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.xamlninja.com/wp-content/uploads/2009/10/Designtimedataprojectstructure1.PNG" alt="Designtimedataprojectstructure" title="Designtimedataprojectstructure" width="444" height="450" class="alignleft size-full wp-image-84" />With the introduction of design time data support in Blend I thought that I would try and take advantage of using design time data and MVVM. For a while now I have been using Ninject, with a Service Locator Pattern to provide the ability to build WPF and Silverlight apps in an MVVM pattern where I prefer to use a View first mechanism. There are a number of benefits from using this approach, one of the ones that we are good to drill to in this post is around Blendability of the controls that developers create. Prior to me using Ninject I would have a heavy reliance on the DesignerProperties IsInDesignMode call to check to see if the control was being render in Blend, as i would normally have to do something to stop the control from crashing and allow myself and the designer to use Blend in order for us to Style and Template the controls we created.</p>
<p>What we are going to cover here is the journey which i went on when adding support for design time data to my project, I really like it as the refactoring from the standard inbuilt mechanism in Blend to the final output is a nice series of steps that feel good.<br />
<a href="http://blogs.xamlninja.com/wp-content/uploads/2009/10/Designtimedata.png" rel="shadowbox[sbpost-34];player=img;"><img style="border-right-width: 0px; margin: 10px 5px 10px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Designtimedata" src="http://blogs.xamlninja.com/wp-content/uploads/2009/10/Designtimedata_thumb.png" border="0" alt="Designtimedata" width="395" height="276" align="right" /></a></p>
<p>The screen shot on the right shows the simple looking UI displaying contextual data in Blend allowing the designer to see how the control will look. I think providing the ability for your application to look exactly the same at design time as at run time is going to mean that you can produce better looking applications quicker as the designer is design the screens in the context of the data.</p>
<p>When first adding the design time data to your project Blend takes over control and this means that you need to use Blend to shape your design time data classes to match your data types used in the system. So if we were building a throw away prototype then I would agree this is the best way forwards, but when you are moving from prototype to production this does not really work. On of the reasons behind the research for this post is around the transition from prototype to production and even from sketch to prototype, once we have sign off from the client on a number of ideas and we want to start to build these out then there is a high potential one will become production quality and because of this its good to have the right architecture in place, so reshaping to MVVM early on will almost certainly cost your client less.</p>
<p>The Xaml below is what i put together to represent the shape of data that was in the mock classes. Blend then hooks this data up to the design time data context for you.</p>
<p>Xaml data for shopping cart</p>
<pre class="brush: xml">
&lt;local:ShoppingCartViewModel xmlns:local=&quot;clr-namespace:DesignDataSample;assembly=DesignDataSample&quot;&gt;
    &lt;local:ShoppingCartViewModel.ShoppingCart xmlns:local=&quot;clr-namespace:DesignDataSample;assembly=DesignDataSample&quot;&gt;
        &lt;local:ShoppingCart&gt;
            &lt;local:ShoppingCart.Items&gt;
                &lt;local:ShoppingCartItem ItemName=&quot;Book Name 1&quot;
                                        ItemDescription=&quot;A very nice book!&quot;
                                        ItemImage=&quot;MySampleDataImages/Tree.jpg&quot; /&gt;
                &lt;local:ShoppingCartItem ItemName=&quot;Book Name 2&quot;
                                        ItemDescription=&quot;A very nice book!&quot;
                                        ItemImage=&quot;MySampleDataImages/Tree.jpg&quot; /&gt;
                &lt;local:ShoppingCartItem ItemName=&quot;Book Name 3&quot;
                                        ItemDescription=&quot;A very nice book!&quot;
                                        ItemImage=&quot;MySampleDataImages/Tree.jpg&quot; /&gt;
                &lt;local:ShoppingCartItem ItemName=&quot;Book Name 4&quot;
                                        ItemDescription=&quot;A very nice book!&quot;
                                        ItemImage=&quot;MySampleDataImages/Tree.jpg&quot; /&gt;
            &lt;/local:ShoppingCart.Items&gt;
        &lt;/local:ShoppingCart&gt;
    &lt;/local:ShoppingCartViewModel.ShoppingCart&gt;
&lt;/local:ShoppingCartViewModel&gt;
</pre>
<p>When the design time data shape matches your real data shape you can then go ahead and use the new d:DataContext Dependency Property and bind your design time data to this property.</p>
<p>Xaml Source code for the control</p>
<pre class="brush: xml">
&lt;UserControl
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
             xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
             xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
             xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
             mc:Ignorable=&quot;d&quot;
             x:Class=&quot;DesignDataSample.ShoppingCartView&quot;
             d:DataContext=&quot;{d:DesignData Source=ShoppingCartSampleData.xaml}&quot;
             DataContext=&quot;{Binding Path=ShoppingCartViewModel, Source={StaticResource serviceLocator}}&quot;
             Height=&quot;347&quot;
             Width=&quot;494&quot;&gt;
</pre>
<p>Nothing too tricky there, the new design time data context is the key to making all this happen, it also means that you can bind any sort of data you want to the design time data context to provide contextual data in Blend during design time. It was at this point that i started to think about how we can really bend the design time data features. My initial refactor was not a great result in that I ended up with 2 sets of mock data; one set of data would be used by the designers in Blend; and the second set of data would be used by the unit test, Not nice, management nightmare to ensure that both data sets are keep in sync.</p>
<p>So the goal was to provide design time data which was the same data used by the unit tests, meaning that we only have one data set to maintain and manage, allowing us to leverage the powerful features of design time data in Blend and also keeping our unit tests looking sweet, pleasing both the designers and the developers on the team.</p>
<p>In order to do this I needed to restructure the existing shape of my data classes that I use in my mock service layer classes, first I needed to change the OnCompleted method to be a virtual implementation and also the method which retrieves the data. This simple change means that we can now provide two mock services that can be injected in.</p>
<p>Refactored mock service class with new virtual methods</p>
<pre class="brush: csharp">
    using System;
    using System.Collections.ObjectModel;

    public class MockShoppingCartService : IShoppingCartService
    {
        public event GetShoppingCartCompletedHandler GetShoppingCartCompleted;

        public bool LoginToShoppingCart(string username, string password)
        {
            throw new System.NotImplementedException();
        }

        public virtual void RetrieveShoppingCart()
        {
            this.OnGetShoppingCartCompleted(null, MockShoppingCartData.CreateShoppingCartRuntime());
        }

        protected virtual void OnGetShoppingCartCompleted(Exception error, ShoppingCart result)
        {
            if (this.GetShoppingCartCompleted != null)
            {
                this.GetShoppingCartCompleted(new GetShoppingCartCompletedEventArgs(error, result));
            }
        }
    }
</pre>
<p>The new mock service class which is used specifically for working with Blend</p>
<pre class="brush: csharp">
namespace DesignDataSample.Mocks
{
    public class MockShoppingCartServiceDesignData : MockShoppingCartService
    {
        public override void RetrieveShoppingCart()
        {
            this.OnGetShoppingCartCompleted(null, MockShoppingCartData.CreateShoppingCartDesigntime());
        }
    }
}
</pre>
<p>How we can use ninject to inject the service we want to use, design time data, mock or real.</p>
<pre class="brush: csharp">
this.Bind&lt;IShoppingCartService&gt;().To&lt;MockShoppingCartService&gt;().OnlyIf(c =&gt; isBrowser);
this.Bind&lt;IShoppingCartService&gt;().To&lt;MockShoppingCartServiceDesignData&gt;().OnlyIf(c =&gt; isBlend);
this.Bind&lt;IShoppingCartService&gt;().To&lt;ShoppingCartService&gt;().OnlyIf(c =&gt; isBrowser);
this.Bind&lt;ShoppingCartViewModel&gt;().ToSelf();
</pre>
<p>Xaml code for how we leverage the data context and the new design time data context for providing contextual data.</p>
<pre class="brush: xml">
&lt;UserControl
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
             xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
             xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
             xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
             mc:Ignorable=&quot;d&quot;
             x:Class=&quot;DesignDataSample.ShoppingCartView&quot;
             d:DataContext=&quot;{Binding Path=ShoppingCartViewModel, Source={StaticResource serviceLocator}}&quot;
             DataContext=&quot;{Binding Path=ShoppingCartViewModel, Source={StaticResource serviceLocator}}&quot; Height=&quot;347&quot; Width=&quot;494&quot;&gt;
&lt;!--d:DataContext=&quot;{d:DesignData Source=ShoppingCartSampleData.xaml}&quot;--&gt;
    &lt;UserControl.Resources&gt;
        &lt;DataTemplate x:Key=&quot;ShoppingCartItemTemplate&quot;&gt;
            &lt;Grid Height=&quot;50&quot;&gt;
                &lt;Grid.ColumnDefinitions&gt;
                    &lt;ColumnDefinition Width=&quot;50&quot; /&gt;
                    &lt;ColumnDefinition Width=&quot;*&quot; /&gt;
                &lt;/Grid.ColumnDefinitions&gt;
                &lt;Grid.RowDefinitions&gt;
                    &lt;RowDefinition Height=&quot;*&quot; /&gt;
                    &lt;RowDefinition Height=&quot;*&quot; /&gt;
                &lt;/Grid.RowDefinitions&gt;

                &lt;Image Source=&quot;{Binding ItemImage}&quot;
                       Grid.RowSpan=&quot;2&quot; /&gt;
                &lt;TextBlock Text=&quot;{Binding ItemName}&quot;
                           Grid.Column=&quot;1&quot;
                           Margin=&quot;4,0,0,0&quot; /&gt;
                &lt;TextBlock Text=&quot;{Binding ItemDescription}&quot;
                           Grid.Column=&quot;1&quot;
                           Grid.Row=&quot;1&quot;
                           Margin=&quot;4,0,0,0&quot; /&gt;
            &lt;/Grid&gt;
        &lt;/DataTemplate&gt;
    &lt;/UserControl.Resources&gt;

    &lt;Grid x:Name=&quot;LayoutRoot&quot;
          Background=&quot;#FFB2B2B2&quot;&gt;
        &lt;Grid.ColumnDefinitions&gt;
            &lt;ColumnDefinition /&gt;
            &lt;ColumnDefinition Width=&quot;129&quot; /&gt;
            &lt;ColumnDefinition Width=&quot;121&quot; /&gt;
        &lt;/Grid.ColumnDefinitions&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition /&gt;
            &lt;RowDefinition Height=&quot;50&quot; /&gt;
        &lt;/Grid.RowDefinitions&gt;
        &lt;ListBox Margin=&quot;8,8,8,26&quot;
                 Grid.ColumnSpan=&quot;3&quot;
                 ItemsSource=&quot;{Binding Mode=OneWay, Path=ShoppingCart.Items}&quot;
                 ItemTemplate=&quot;{StaticResource ShoppingCartItemTemplate}&quot; /&gt;
        &lt;TextBlock Grid.Row=&quot;1&quot;
                   Text=&quot;Total Items:&quot;
                   TextWrapping=&quot;Wrap&quot;
                   Grid.Column=&quot;1&quot; /&gt;
        &lt;TextBlock Grid.Column=&quot;2&quot;
                   Grid.Row=&quot;1&quot;
                   Text=&quot;{Binding ShoppingCart.Items.Count}&quot;
                   TextWrapping=&quot;Wrap&quot; /&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;</pre>
<p> </p>
<p>So I hope that this article has opened your eyes to how useful design time data can be to enhance the Blendability of the controls which you produce both lookless and user. In the majority of cases designers that you are working with really like that they can view the control at deign time how it will appear when running in your application and populated with data.  When implementing the MVVM pattern in you application incorporating support for design time data is also possible and provides you with the ultimate Xaml Ninja experience.</p>
<p>You can download the source from my Skydrive.</p>
<p><iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-118ee1873690fc1d.skydrive.live.com/embedicon.aspx/Silverlight3/DesignData/DesignDataSample.zip"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.xamlninja.com/silverlight/mvvm-design-time-data-and-blendability/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

