<?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>Ben Dewey - Web, XAML, and Cloud &#187; Expression Blend</title>
	<atom:link href="http://www.bendewey.com/index.php/tag/expression-blend/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bendewey.com</link>
	<description>Father, Developer, Microsoft MVP, Speaker, and Author</description>
	<lastBuildDate>Sat, 22 Mar 2025 05:04:02 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.8.41</generator>
	<item>
		<title>Easily use DesignData with Caliburn.Micro for Windows Store apps</title>
		<link>http://www.bendewey.com/index.php/419/easily-use-designdata-with-caliburn-micro-for-windows-store-apps</link>
		<comments>http://www.bendewey.com/index.php/419/easily-use-designdata-with-caliburn-micro-for-windows-store-apps#comments</comments>
		<pubDate>Thu, 09 Jan 2014 02:46:30 +0000</pubDate>
		<dc:creator><![CDATA[bendewey]]></dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[Windows8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://www.bendewey.com/blog/?p=419</guid>
		<description><![CDATA[They may have removed the sample data functionality in the latest versions of Blend, but have no fear, you can still accomplish effective Designer/Developer workflows.]]></description>
				<content:encoded><![CDATA[<p>They may have removed the sample data functionality in the latest versions of Blend, but have no fear, you can still accomplish effective Designer/Developer workflows using custom design data and the Model-View-ViewModel (MVVM) Pattern. I was setting up the sample data functionality on our latest mobile project and I wanted to write this quick blog post to help others setting up the same thing. To start I created our Windows Store application, added the Caliburn.Micro NuGet package, and created the initial View and ViewModel for our Hub page.</p>
<p>The first step is to create an extended version of your ViewModel, in my case I created a folder called SampleData and added a new class called HubPageViewModelSampleData.cs</p>
<a href="http://www.bendewey.com/blog/index.php/419/easily-use-designdata-with-caliburn-micro-for-windows-store-apps/solution" rel="attachment wp-att-421"><img class="alignnone size-full wp-image-421" title="solution" alt="" src="http://www.bendewey.com/blog/wp-content/uploads/2014/01/solution.png" width="301" height="231" /></a>
<p>This HubPageViewModelSampleData class inherits from our HubPageViewMode and just initializes the sample data in the constructor.</p>
<pre class="brush: csharp; title: ; notranslate">
public class HubPageViewModelSampleData : HubPageViewModel
{
	public HubPageViewModelSampleData()
		: base(null, null, null)
	{
		DisplayName = &quot;Hub&quot;;
		Sites = new ObservableCollection&lt;Site&gt;()
		{
			new Site() {
				SiteName = &quot;Site 1&quot;,
				SiteUrl = &quot;http://www.example.com/123&quot;,
				Status=&quot;Online&quot; },
			new Site() {
				SiteName = &quot;Site 2&quot;,
				SiteUrl = &quot;http://www.example.com/456&quot;,
				Status=&quot;Online&quot; },
			new Site() {
				SiteName = &quot;Long Site 1&quot;,
				SiteUrl = &quot;http://www.example.com/123/abcdefg/456/hijklmnop.html&quot;,
				Status=&quot;Offline&quot; }
		};
	}
}
</pre>
<p>If your base class has any dependencies injected you can supply a parameterless constructor override with null values or null implementations. You can also insert overridden methods/properties, which I would tend to prefer over injecting your ViewModel with a lot of checks for DesignMode.DesignModeEnabled. Once you have your sample data view model created you just have to wire it up to your view. In order to do this you&#8217;ll need setup the design time DataContext with a design time instance to this sample data view model.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;Page
x:Class=&quot;App.Views.HubPage&quot;
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;
xmlns:system=&quot;using:System&quot;
xmlns:micro=&quot;using:Caliburn.Micro&quot;
d:DataContext=&quot;{d:DesignInstance Type=sampleData:HubPageViewModelSampleData, IsDesignTimeCreatable=True}&quot;
mc:Ignorable=&quot;d&quot;&gt;
&lt;!-- … --&gt;
&lt;/Page&gt;
</pre>
<p>Visual Studio supports this design context for DataBinding and will work if you use declarative {Binding} statements in your XAML. While this way doesn&#8217;t use Blend and it is still part of your deployed Appx, it is easy to setup. Unfortunately this won&#8217;t work with our project because we are using Caliburn.Micro. One of the great features of Caliburn.Micro is the ability to do <a href="http://caliburnmicro.codeplex.com/wikipage?title=All%20About%20Conventions">convention based binding</a>. This feature doesn&#8217;t use the declartive Binding syntax that the XAML designer is expecting. Because of this the bindings don&#8217;t work with the XAML for a Caliburn.Micro view. Luckily the team has provided an attached property that executes just the ViewBinding portion of the framework in design mode. This attached property Bind.AtDesignTime should be added to the same control that has you&#8217;re design DataContext as you can see here.</p>
<pre class="brush: xml; highlight: [8,11]; title: ; notranslate">
&lt;Page
x:Class=&quot;App.Views.HubPage&quot;
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;
xmlns:system=&quot;using:System&quot;
xmlns:micro=&quot;using:Caliburn.Micro&quot;
xmlns:sampleData=&quot;using:App.SampleData&quot;
d:DataContext=&quot;{d:DesignInstance Type=sampleData:HubPageViewModelSampleData, IsDesignTimeCreatable=True}&quot;
micro:Bind.AtDesignTime=&quot;True&quot;
mc:Ignorable=&quot;d&quot;&gt;
&lt;!-- … --&gt;
&lt;/Page&gt;
</pre>
<p>With this in place we can see the effects of our design decisions right in the designer without having to run the app.<br />
<a href="http://www.bendewey.com/blog/index.php/419/easily-use-designdata-with-caliburn-micro-for-windows-store-apps/sample_data" rel="attachment wp-att-422"><img class="alignnone size-full wp-image-422" title="sample_data" alt="" src="http://www.bendewey.com/blog/wp-content/uploads/2014/01/sample_data.png" width="478" height="379" /></a><br />
By following these steps you can setup sample data support for all your view models hopefully achieve the symbiotic moment you get from an effective developer/designer workflow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bendewey.com/index.php/419/easily-use-designdata-with-caliburn-micro-for-windows-store-apps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending the SampleData Strings in Expression Blend</title>
		<link>http://www.bendewey.com/index.php/254/extending-the-sampledata-strings-in-expression-blend</link>
		<comments>http://www.bendewey.com/index.php/254/extending-the-sampledata-strings-in-expression-blend#comments</comments>
		<pubDate>Wed, 02 Jun 2010 14:59:15 +0000</pubDate>
		<dc:creator><![CDATA[bendewey]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.bendewey.com/blog/?p=254</guid>
		<description><![CDATA[I was working today on a WPF project in Expression Blend that used Sample Data heavily.  I needed to create my own custom sample data format, after searching.]]></description>
				<content:encoded><![CDATA[<p>I was working today on a WPF project in Expression Blend that used Sample Data heavily.  I needed to create my own custom sample data format, after searching a bit for a way to extend the Expression Sample Data string formats and not having any luck I decided to dig around on my own.  To my suprise this was extremely easy to accomplish so I wanted to post this so that others might be able to benefit from this.</p>
<p>I was building a testing application and I wanted to create sample data for Duration (eg: 00:00:00.0135098).  The closest sample I found was Time, but that actually produced an AM/PM time (eg: 12:00:00 AM).</p>
<a href="http://www.bendewey.com/blog/wp-content/uploads/2010/06/before-extending.png"><img class="alignnone size-medium wp-image-255" title="before-extending" src="http://www.bendewey.com/blog/wp-content/uploads/2010/06/before-extending-300x244.png" alt="" width="300" height="244" /></a>
<p>If you open up &#8216;C:\Program Files\Microsoft Expression\Blend 3\SampleDataResources\en&#8217; on your computer you will see a Data and Images folder inside the Data folder is a CSV file called SampleStrings.csv. </p>
<a href="http://www.bendewey.com/blog/wp-content/uploads/2010/06/data-folder.png"><img class="alignnone size-medium wp-image-256" title="data-folder" src="http://www.bendewey.com/blog/wp-content/uploads/2010/06/data-folder-300x232.png" alt="" width="300" height="232" /></a>
<p>I created a backup first (as you should) and then opened the file in Excel.  From there I simply added my new field for Duration and saved the file.  After closing Expression Blend and restarting it I opened my sample data and found the new values that I added ready for my use.</p>
<a href="http://www.bendewey.com/blog/wp-content/uploads/2010/06/after-extending.png"><img class="alignnone size-medium wp-image-257" title="after-extending" src="http://www.bendewey.com/blog/wp-content/uploads/2010/06/after-extending-300x253.png" alt="" width="300" height="253" /></a>
<p>In my scenario I had 10 rows of sample data, but I only entered 5 rows of data into the SampleStrings.csv file.  The data simple repeated just as I expected.</p>
<a href="http://www.bendewey.com/blog/wp-content/uploads/2010/06/sample-data.png"><img class="alignnone size-medium wp-image-258" title="sample-data" src="http://www.bendewey.com/blog/wp-content/uploads/2010/06/sample-data-300x204.png" alt="" width="300" height="204" /></a>
<p>Thank you to the Expression Blend Team for creating such and easy extension model and I hope this helps someone else along the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bendewey.com/index.php/254/extending-the-sampledata-strings-in-expression-blend/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
