<?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>Elegant Code &#187; Brian Lagunas</title>
	<atom:link href="http://elegantcode.com/author/blagunas/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Sat, 18 May 2013 03:09:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Windows 8 Unleashed&#8211;Boise</title>
		<link>http://elegantcode.com/2012/08/20/windows-8-unleashedboise/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-8-unleashedboise</link>
		<comments>http://elegantcode.com/2012/08/20/windows-8-unleashedboise/#comments</comments>
		<pubDate>Mon, 20 Aug 2012 22:56:14 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[User Group]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5256</guid>
		<description><![CDATA[Have you heard about Windows 8 Unleashed yet?&#160; “Windows 8 Unleashed” is a series of FREE events run by your local community friends and leaders, and are great whether you are an experienced .NET developer, or even if you are just getting started.&#160; I am excited to announce that Boise will be hosting its very [...]]]></description>
				<content:encoded><![CDATA[<p>Have you heard about <a href="http://windows8unleashed.com/" target="_blank">Windows 8 Unleashed</a> yet?&#160; “Windows 8 Unleashed” is a series of <strong><em>FREE </em></strong><em></em>events run by your local community friends and leaders, and are great whether you are an experienced .NET developer, or even if you are just getting started.&#160; I am excited to announce that Boise will be hosting its very own Windows 8 Unleashed event.&#160; Yeah, that’s right.&#160; You heard me!&#160; <strong>A full day of hands on training for FREE! </strong></p>
<h3>B.Y.O. Laptop!</h3>
<p>Come join me and spend the morning in lecture and hands on labs. Half way through, you’ll get a chance to take what you learned in the morning and compete in a friendly contest with a chance to win some great prizes!&#160; More on that in a minute. </p>
<h4>When and Where</h4>
<p>The event is being held on Friday, Sept 28 starting at 8 a.m and goes to 8 p.m.&#160; My friends at URS Energy and Construction have kindly let us use their awesome facility located at: </p>
<p>720 Park Blvd    <br />Boise, ID 83704     <br /><a href="http://binged.it/PsbV5j" target="_blank">see the map</a> </p>
<p>The auditorium can be found in the basement of Plaza 1. </p>
<h4>Feed Me</h4>
<p>Feed them, and they will come.&#160; Breakfast, lunch, and dinner (if necessary) will be provided to you to help fuel all the keystrokes that will be unleashed.</p>
<h4>Required Software and Downloads</h4>
<p>Please make sure to get the required software and downloads BEFORE coming to the event. You can find everything you need on the “<a href="http://devunleashed.com/windows-8-unleashed-installs/"><u>Windows 8 Unleashed Installs</u></a>” page. </p>
<h4>Agenda</h4>
<p><strong>Session I – Overview</strong></p>
<ul>
<li>Metro Style Apps Overview </li>
<li>Developing Metro Style Apps </li>
<li>Working with Controls </li>
<li>Implementing Navigation </li>
</ul>
<p><strong>Session II – Location and Data</strong></p>
<ul>
<li>Working with Location </li>
<li>Data Binding </li>
<li>Roaming </li>
<li>App Bar </li>
</ul>
<p><strong>Session III – Metro Principals</strong></p>
<ul>
<li>Live Tiles &amp; Toast </li>
<li>Contracts </li>
<li>Full, Fill, Snap and Portrait Views </li>
<li>Advertising </li>
</ul>
<h3>Build an App and Win Money and Prizes!</h3>
<p>Our sponsors have stepped up with some awesome prizes. Not only do you get a ton of information for FREE, but you have an opportunity to win some awesome stuff! You can’t afford to miss this! </p>
<p><strong>DAY-OF prizes will be awarded (<em>sponsored by PDSA</em>):</strong></p>
<ul>
<li>1st Place: $500 Gift Card </li>
<li>2nd Place: $200 Gift Card </li>
<li>3rd Place: $100 Gift Card </li>
</ul>
<p><strong>“Best Overall App” Prizes will be awarded to the best app from ALL unleashed events:</strong></p>
<ul>
<li>$10,000 from <em>ComponentArt</em> </li>
<li>Windows 8 Tablet from <em>PDSA, Inc.</em> </li>
</ul>
<p><em>In addition all attendees will receive a FREE eBook from O’Reilly</em> </p>
<h1 align="center"><a href="http://win8unleashedboise.eventbrite.com/" target="_blank">REGISTER NOW</a></h1>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/08/20/windows-8-unleashedboise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building IG Outlook Part 4 &#8211; Creating Custom Region Adapters</title>
		<link>http://elegantcode.com/2012/06/01/building-ig-outlook-part-4-creating-custom-region-adapters/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-ig-outlook-part-4-creating-custom-region-adapters</link>
		<comments>http://elegantcode.com/2012/06/01/building-ig-outlook-part-4-creating-custom-region-adapters/#comments</comments>
		<pubDate>Fri, 01 Jun 2012 19:00:00 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[prism]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5176</guid>
		<description><![CDATA[This is the fourth video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; In this video we create custom region adapters for the Infragistics XamRibbon and XamOutlookBar controls that are defined as regions in our application’s shell. The code you really care about are the two [...]]]></description>
				<content:encoded><![CDATA[<p>This is the fourth video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; In this video we create custom region adapters for the Infragistics <a href="http://samples.infragistics.com/sllob/ribbon" target="_blank">XamRibbon</a> and <a href="http://samples.infragistics.com/sllob/outlook-bar" target="_blank">XamOutlookBar</a> controls that are defined as regions in our application’s shell.</p>
<p>The code you really care about are the two region adapters.</p>
<p>XamRibbon</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:87599fe9-3726-4245-afb7-84d684a892d3" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">#if</span> !SILVERLIGHT<br /> <span style="color:#808080">using Infragistics.Windows.Ribbon;</span><br /> <span style="color:#0000ff">#else</span><br /> <span style="color:#0000ff">using</span> Infragistics.Controls.Menus;<br /> <span style="color:#0000ff">#endif</span></p>
<p> <span style="color:#0000ff">namespace</span> IgOutlook.Infrastructure.Prism<br /> {<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">XamRibbonRegionAdapter</span> : <span style="color:#2b91af">RegionAdapterBase</span>&lt;<span style="color:#2b91af">XamRibbon</span>&gt;<br />     {<br />         <span style="color:#0000ff">public</span> XamRibbonRegionAdapter(<span style="color:#2b91af">IRegionBehaviorFactory</span> regionBehaviorFactory)<br />             : <span style="color:#0000ff">base</span>(regionBehaviorFactory)<br />         {<br />         }</p>
<p>         <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> Adapt(<span style="color:#2b91af">IRegion</span> region, <span style="color:#2b91af">XamRibbon</span> regionTarget)<br />         {<br />             <span style="color:#0000ff">if</span> (region == <span style="color:#0000ff">null</span>) <span style="color:#0000ff">throw</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">ArgumentNullException</span>(<span style="color:#a31515">&quot;region&quot;</span>);<br />             <span style="color:#0000ff">if</span> (regionTarget == <span style="color:#0000ff">null</span>) <span style="color:#0000ff">throw</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">ArgumentNullException</span>(<span style="color:#a31515">&quot;regionTarget&quot;</span>);</p>
<p>             region.ActiveViews.CollectionChanged += (s, args) =&gt;<br />             {<br />                 <span style="color:#0000ff">switch</span> (args.Action)<br />                 {<br />                     <span style="color:#0000ff">case</span> <span style="color:#2b91af">NotifyCollectionChangedAction</span>.Add:<br />                         {<br />                             <span style="color:#0000ff">foreach</span> (<span style="color:#2b91af">Object</span> view <span style="color:#0000ff">in</span> args.NewItems)<br />                             {<br />                                 AddViewToRegion(view, regionTarget);<br />                             }<br />                             <span style="color:#0000ff">break</span>;<br />                         }<br />                     <span style="color:#0000ff">case</span> <span style="color:#2b91af">NotifyCollectionChangedAction</span>.Remove:<br />                         {<br />                             <span style="color:#0000ff">foreach</span> (<span style="color:#2b91af">Object</span> view <span style="color:#0000ff">in</span> args.OldItems)<br />                             {<br />                                 RemoveViewFromRegion(view, regionTarget);<br />                             }<br />                             <span style="color:#0000ff">break</span>;<br />                         }<br />                     <span style="color:#0000ff">default</span>:<br />                         {<br />                             <span style="color:#008000">// Do nothing.</span><br />                             <span style="color:#0000ff">break</span>;<br />                         }<br />                 }<br />             };<br />         }</p>
<p>         <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#2b91af">IRegion</span> CreateRegion()<br />         {<br />             <span style="color:#0000ff">return</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">AllActiveRegion</span>();<br />         }</p>
<p>         <span style="color:#0000ff">static</span> <span style="color:#0000ff">void</span> AddViewToRegion(<span style="color:#2b91af">Object</span> view, <span style="color:#2b91af">XamRibbon</span> xamRibbon)<br />         {<br />             <span style="color:#008000">//TODO: implement in later video</span><br />         }</p>
<p>         <span style="color:#0000ff">static</span> <span style="color:#0000ff">void</span> RemoveViewFromRegion(<span style="color:#2b91af">Object</span> view, <span style="color:#2b91af">XamRibbon</span> xamRibbon)<br />         {<br />             <span style="color:#008000">//TODO: implement in later video</span><br />         }<br />     }<br /> }</div>
</p></div>
</p></div>
<p>XamOutlookBar</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5e6ef9e1-e610-4150-a48a-8f69a482ed71" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">#if</span> SILVERLIGHT<br /> <span style="color:#0000ff">using</span> Infragistics.Controls.Menus;<br /> <span style="color:#0000ff">#else</span><br /> <span style="color:#808080">using Infragistics.Windows.OutlookBar;</span><br /> <span style="color:#0000ff">#endif</span></p>
<p> <span style="color:#0000ff">namespace</span> IgOutlook.Infrastructure.Prism<br /> {<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">XamOutlookBarRegionAdapter</span> : <span style="color:#2b91af">RegionAdapterBase</span>&lt;<span style="color:#2b91af">XamOutlookBar</span>&gt;<br />     {<br />         <span style="color:#0000ff">public</span> XamOutlookBarRegionAdapter(<span style="color:#2b91af">IRegionBehaviorFactory</span> factory)<br />             : <span style="color:#0000ff">base</span> (factory)<br />         {</p>
<p>         }</p>
<p>         <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> Adapt(<span style="color:#2b91af">IRegion</span> region, <span style="color:#2b91af">XamOutlookBar</span> regionTarget)<br />         {<br />             region.ActiveViews.CollectionChanged += ((x, y) =&gt;<br />                 {<br />                     <span style="color:#0000ff">switch</span> (y.Action)<br />                     {<br />                         <span style="color:#0000ff">case</span> System.Collections.Specialized.<span style="color:#2b91af">NotifyCollectionChangedAction</span>.Add:<br />                             {<br />                                 <span style="color:#0000ff">foreach</span> (<span style="color:#2b91af">OutlookBarGroup</span> group <span style="color:#0000ff">in</span> y.NewItems)<br />                                 {<br />                                     regionTarget.Groups.Add(group);</p>
<p> <span style="color:#0000ff">#if</span> !SILVERLIGHT<br />                                 <span style="color:#808080">//The WPF XamOutlookBar does not automatically select the first group in it&#39;s collection.</span><br />                                 <span style="color:#808080">//So we must manually select the group if it is the first one in the collection, but we don&#39;t</span><br />                                 <span style="color:#808080">//want to excute this code every time a new group is added, only if the first group is the current group being added.</span><br />                                 <span style="color:#808080">if (regionTarget.Groups[0] == group)</span><br />                                 <span style="color:#808080">{</span><br />                                     <span style="color:#808080">regionTarget.SelectedGroup = group;</span><br />                                 <span style="color:#808080">}</span><br /> <span style="color:#0000ff">#endif</span></p>
<p>                                 }<br />                                 <span style="color:#0000ff">break</span>;<br />                             }<br />                         <span style="color:#0000ff">case</span> System.Collections.Specialized.<span style="color:#2b91af">NotifyCollectionChangedAction</span>.Remove:<br />                             {<br />                                 <span style="color:#0000ff">foreach</span> (<span style="color:#2b91af">OutlookBarGroup</span> group <span style="color:#0000ff">in</span> y.NewItems)<br />                                 {<br />                                     regionTarget.Groups.Remove(group);<br />                                 }<br />                                 <span style="color:#0000ff">break</span>;<br />                             }<br />                     }<br />                 });<br />         }</p>
<p>         <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#2b91af">IRegion</span> CreateRegion()<br />         {<br />             <span style="color:#0000ff">return</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">AllActiveRegion</span>();<br />         }<br />     }<br /> }</div>
</p></div>
</p></div>
<p>Of course don’t forget to register your mappings in your bootstrapper.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:bfe7eac7-16a6-4604-8397-3e8003c21ef3" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> Microsoft.Practices.Prism.Regions.<span style="color:#2b91af">RegionAdapterMappings</span> ConfigureRegionAdapterMappings()<br /> {<br />     <span style="color:#2b91af">RegionAdapterMappings</span> mappings = <span style="color:#0000ff">base</span>.ConfigureRegionAdapterMappings();<br />     mappings.RegisterMapping(<span style="color:#0000ff">typeof</span>(<span style="color:#2b91af">XamOutlookBar</span>), Container.Resolve&lt;<span style="color:#2b91af">XamOutlookBarRegionAdapter</span>&gt;());<br />     mappings.RegisterMapping(<span style="color:#0000ff">typeof</span>(<span style="color:#2b91af">XamRibbon</span>), Container.Resolve&lt;<span style="color:#2b91af">XamRibbonRegionAdapter</span>&gt;());<br />     <span style="color:#0000ff">return</span> mappings;</div>
</p></div>
</p></div>
<p>&#160;</p>
<p>Watch the video on <a href="http://xaml.tv/2012/06/01/building-ig-outlook-part-4-creating-custom-region-adapters/" target="_blank">Xaml TV</a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/06/01/building-ig-outlook-part-4-creating-custom-region-adapters/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Building IG Outlook Part 3 &#8211; Creating the Mail Module</title>
		<link>http://elegantcode.com/2012/05/31/building-ig-outlook-part-3-creating-the-mail-module/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-ig-outlook-part-3-creating-the-mail-module</link>
		<comments>http://elegantcode.com/2012/05/31/building-ig-outlook-part-3-creating-the-mail-module/#comments</comments>
		<pubDate>Thu, 31 May 2012 19:00:00 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[xaml tv]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5174</guid>
		<description><![CDATA[This is the third video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; In this video we will create the first module in the application called the Mail module.&#160; We concentrate on just stubbing out the module project, creating a module catalog, adding the Mail module [...]]]></description>
				<content:encoded><![CDATA[<p>This is the third video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; In this video we will create the first module in the application called the Mail module.&#160; We concentrate on just stubbing out the module project, creating a module catalog, adding the Mail module to it in the bootstrapper.&#160; We also inject our first navigation view, in the form of an <a href="http://www.infragistics.com/" target="_blank">Infragistics</a> OutlookBarGroup, into our OutlookBar region defined in our shell.&#160; We do this for both the WPF and Silverlight platforms.</p>
<p>Watch the video on <a href="http://xaml.tv/2012/05/31/building-ig-outlook-part-3-creating-the-mail-module/" target="_blank">Xaml TV</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/05/31/building-ig-outlook-part-3-creating-the-mail-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building IG Outlook Part 2 &#8211; Creating the Shell</title>
		<link>http://elegantcode.com/2012/05/30/building-ig-outlook-part-2-creating-the-shell/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-ig-outlook-part-2-creating-the-shell</link>
		<comments>http://elegantcode.com/2012/05/30/building-ig-outlook-part-2-creating-the-shell/#comments</comments>
		<pubDate>Wed, 30 May 2012 19:43:57 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5172</guid>
		<description><![CDATA[This is the second video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; In this video, I walk you through creating a shell for both the WPF and Silverlight platforms.&#160; This is a relatively short video, because shells are just so stinking easy.&#160; The only concept [...]]]></description>
				<content:encoded><![CDATA[<p>This is the second video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; In this video, I walk you through creating a shell for both the WPF and Silverlight platforms.&#160; This is a relatively short video, because shells are just so stinking easy.&#160; The only concept introduced in this video is a Region.&#160; A Region basically defines elements within your shell as containers for views that will be composed at runtime.&#160; We also start utilizing controls from <a href="http://www.infragistics.com/" target="_blank">Infragistics</a> NetAdvantage for <a href="http://www.infragistics.com/dotnet/netadvantage/wpf.aspx" target="_blank">WPF</a> and <a href="http://www.infragistics.com/dotnet/netadvantage/silverlight/line-of-business.aspx" target="_blank">Silverlight</a>, such as the <a href="http://samples.infragistics.com/sllob/outlook-bar" target="_blank">XamOutlookBar</a> and <a href="http://samples.infragistics.com/sllob/ribbon" target="_blank">XamRibbon</a>.</p>
<p>Watch the video on <a href="http://xaml.tv/2012/05/30/building-ig-outlook-part-2-creating-the-shell/" target="_blank">Xaml TV</a>.</p>
<p>If you have any questions feel free to leave a comment or contact me on twitter (<a href="http://twitter.com/brianlagunas" target="_blank">@BrianLagunas</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/05/30/building-ig-outlook-part-2-creating-the-shell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building IG Outlook Part 1&#8211;Setting up the Prism Application</title>
		<link>http://elegantcode.com/2012/04/25/building-ig-outlook-part-1setting-up-the-prism-application/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-ig-outlook-part-1setting-up-the-prism-application</link>
		<comments>http://elegantcode.com/2012/04/25/building-ig-outlook-part-1setting-up-the-prism-application/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 20:03:18 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[prism]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5158</guid>
		<description><![CDATA[This is the first video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; This video covers how to setup a multi-platform Prism application that targets WPF and Silverlight.&#160; I show you how to setup your directory structure, as well as the solution/project structure inside Visual Studio.&#160; [...]]]></description>
				<content:encoded><![CDATA[<p>This is the first video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; This video covers how to setup a multi-platform Prism application that targets WPF and Silverlight.&#160; I show you how to setup your directory structure, as well as the solution/project structure inside Visual Studio.&#160; We also create a functional Silverlight and WPF shell application and see our first glimpse of code sharing with the bootstrapper.</p>
<p>Watch the video on <a href="http://xaml.tv/2012/04/25/building-ig-outlook-part-1-setting-up-the-prism-application/" target="_blank">Xaml TV</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/04/25/building-ig-outlook-part-1setting-up-the-prism-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building IG Outlook&#8211; Introduction to a Prism App</title>
		<link>http://elegantcode.com/2012/04/23/building-ig-outlook-introduction-to-a-prism-app/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-ig-outlook-introduction-to-a-prism-app</link>
		<comments>http://elegantcode.com/2012/04/23/building-ig-outlook-introduction-to-a-prism-app/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 01:41:57 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[NetAdvantage]]></category>
		<category><![CDATA[prism]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5156</guid>
		<description><![CDATA[Often when learning a technology you start by searching the web.&#160; You look for videos, blogs, articles, samples, and examples.&#160; What you start to realize is that everything you find is very simple “demo” code.&#160; That’s code that shows how to implement a simple feature in a non-realistic demo.&#160; Then you start looking for “production” [...]]]></description>
				<content:encoded><![CDATA[<p>Often when learning a technology you start by searching the web.&#160; You look for videos, blogs, articles, samples, and examples.&#160; What you start to realize is that everything you find is very simple “demo” code.&#160; That’s code that shows how to implement a simple feature in a non-realistic demo.&#160; Then you start looking for “production” code examples.&#160; That’s code that represents a more realistic implementation of an application in a production environment.&#160; This type of resource is very difficult to find.&#160; Why?&#160; Mainly, because it is very time consuming to create such examples.</p>
<p>This scenario is no different when trying to learn Prism.&#160; You probably first start by reading though the <a href="http://msdn.microsoft.com/en-us/library/gg406140.aspx" target="_blank">documentation</a>.&#160; Next, you head on over to Pluralsight and watch my <a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank">Introduction to Prism</a> course.&#160; Now that you know all the basics you start searching the web for examples for specific scenarios.&#160; How do I do “x” and “y”?&#160; How do I apply this sample code to my application?&#160; Hopefully I can help you answer those questions.</p>
<p>I am starting a new video series called Building IG Outlook.&#160; I will take you step-by-step on building a Prism application that mimics Microsoft Outlook.&#160; We will be discussing the following key areas in no specific order:</p>
<ol>
<li>Application architecture/structure </li>
<li>Multi-platform support (WPF and Silverlight) </li>
<li>Commanding </li>
<li>Event aggregation </li>
<li>Custom RegionAdapters </li>
<li>Custom RegionBehaviors </li>
<li>Navigation (OutlookBar, Ribbon, and View interaction) </li>
<li>MVVM (no frameworks needed) </li>
</ol>
<p>Like most production applications we will have a dependency on a 3rd party toolset.&#160; I will be using Infragistics NetAdvantage for WPF and Silverlight.&#160; If you don’t own Infragistics you can download the trial or purchase the suite so you can compile and run all the sample code.&#160; Otherwise, you will have to modify the code to work with your vendor of choice.</p>
<p>I hope this series will help you gain a better understanding of how you can use the various aspects of Prism to build your applications.&#160; This will be a long series and I plan to record at least one a week depending on my traveling schedule.&#160; If you have any questions or would like to see something specific be sure to let me know, and I will see if I can squeeze an example in the application.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/04/23/building-ig-outlook-introduction-to-a-prism-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Custom Prism RegionAdapter</title>
		<link>http://elegantcode.com/2012/04/18/create-a-custom-prism-regionadapter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-a-custom-prism-regionadapter</link>
		<comments>http://elegantcode.com/2012/04/18/create-a-custom-prism-regionadapter/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 19:26:48 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5148</guid>
		<description><![CDATA[Don’t want to read the article?&#160; Watch the video tutorial on Xaml TV. Prism provides 4 region adapters out of the box for you: ContentControlRegionAdapter SelectorRegionAdaptor ItemsControlRegionAdapter TabControlRegionAdapter (Silverlight only) Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a custom region adapter for [...]]]></description>
				<content:encoded><![CDATA[<p>Don’t want to read the article?&#160; Watch the video tutorial on <a href="http://xaml.tv/2012/04/18/create-a-custom-prism-regionadapter/" target="_blank">Xaml TV</a>.</p>
<p>Prism provides 4 region adapters out of the box for you:</p>
<ul>
<li>ContentControlRegionAdapter </li>
<li>SelectorRegionAdaptor </li>
<li>ItemsControlRegionAdapter </li>
<li>TabControlRegionAdapter (Silverlight only) </li>
</ul>
<p>Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a custom region adapter for it.&#160; Is it hard you ask?&#160; No it is quite easy.&#160; Let’s write one for the StackPanel.</p>
<p>Start by creating a class the derive from and implements the base abstract class RegionAdapterBase&lt;T&gt;.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:42841886-07a5-4824-b616-f916daec35cc" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">StackPanelRegionAdapter</span> : <span style="color:#2b91af">RegionAdapterBase</span>&lt;<span style="color:#2b91af">StackPanel</span>&gt;<br /> {<br />     <span style="color:#0000ff">public</span> StackPanelRegionAdapter(<span style="color:#2b91af">IRegionBehaviorFactory</span> factory)<br />         : <span style="color:#0000ff">base</span>(factory)<br />     {</p>
<p>     }</p>
<p>     <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> Adapt(<span style="color:#2b91af">IRegion</span> region, <span style="color:#2b91af">StackPanel</span> regionTarget)<br />     {<br />         region.Views.CollectionChanged += (s, e) =&gt;<br />             {<br />                 <span style="color:#0000ff">if</span> (e.Action == <span style="color:#2b91af">NotifyCollectionChangedAction</span>.Add)<br />                 {<br />                     <span style="color:#0000ff">foreach</span> (<span style="color:#2b91af">FrameworkElement</span> element <span style="color:#0000ff">in</span> e.NewItems)<br />                     {<br />                         regionTarget.Children.Add(element);<br />                     }<br />                 }</p>
<p>                 <span style="color:#008000">//implement remove</span><br />             };<br />     }</p>
<p>     <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#2b91af">IRegion</span> CreateRegion()<br />     {<br />         <span style="color:#0000ff">return</span> <span style="color:#0000ff">new</span> <span style="color:#2b91af">AllActiveRegion</span>();<br />     }<br /> }</div>
</p></div>
</p></div>
<p>Notice that there are two methods we need to implement. Adapt and CreateRegion.&#160; CreateRegion return the type of region we will need.&#160; In our case we want to support multiple views so we need to return an instance of an AllActiveRegion.&#160; If we only needed support for one view at a time we would return a SingleActiveRegion.&#160; The Adapt method is responsible for adapting the region to our control.&#160; This is where we will add and remove the views to or host control.</p>
<p>Now we simply have to tell Prism about our new RegionAdapter.&#160; We do this in the bootstrapper.&#160; Simply override the ConfigureRegionAdapterMappings method as follows:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a055d5d5-0c63-4fe5-a67e-cd8a5b2b7ee3" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> Microsoft.Practices.Prism.Regions.<span style="color:#2b91af">RegionAdapterMappings</span> ConfigureRegionAdapterMappings()<br /> {<br />     <span style="color:#2b91af">RegionAdapterMappings</span> mappings = <span style="color:#0000ff">base</span>.ConfigureRegionAdapterMappings();<br />     mappings.RegisterMapping(<span style="color:#0000ff">typeof</span>(<span style="color:#2b91af">StackPanel</span>), Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br />     <span style="color:#0000ff">return</span> mappings;<br /> }</div>
</p></div>
</p></div>
<p>That’s it.&#160; Now you can use a StackPanel as a region host:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:acfd8aa2-6c0e-40af-8018-6d9021cfd008" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px; white-space: nowrap"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">StackPanel</span><span style="color:#ff0000"> Orientation</span><span style="color:#0000ff">=&quot;Horizontal&quot;</span><br />            <span style="color:#ff0000"> prism</span><span style="color:#0000ff">:</span><span style="color:#ff0000">RegionManager.RegionName</span><span style="color:#0000ff">=&quot;MyRegion&quot; /&gt;</span></div>
</p></div>
</p></div>
<p>&#160;</p>
<p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/04/18/create-a-custom-prism-regionadapter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Validate a Property Against a Parent Collection</title>
		<link>http://elegantcode.com/2012/04/11/validate-a-property-against-a-parent-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=validate-a-property-against-a-parent-collection</link>
		<comments>http://elegantcode.com/2012/04/11/validate-a-property-against-a-parent-collection/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 00:34:53 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Validation]]></category>
		<category><![CDATA[XamDataGrid]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=5076</guid>
		<description><![CDATA[I was monitoring my Twitter feed, like I always do, and saw a tweet come through asking about how to validate an object’s property against it’s parent ObservableCollection in the Infragistics XamDataGrid.&#160; What this person was trying to accomplish was to validate a duplicate item in his data source.&#160; They have a POCO object the [...]]]></description>
				<content:encoded><![CDATA[<p>I was monitoring my Twitter feed, like I always do, and saw a tweet come through asking about how to validate an object’s property against it’s parent ObservableCollection in the <a href="http://www.infragistics.com/" target="_blank">Infragistics</a> XamDataGrid.&#160; What this person was trying to accomplish was to validate a duplicate item in his data source.&#160; They have a POCO object the implements the IDataErrorInfo interface, and an ObservableColletion&lt;POCO&gt; as the data source.&#160; They want to check the ObservableCollection&lt;POCO&gt; for a pre-existing item whenever a property value in a POCO changes.&#160; Obviously this is not a XamDataGrid issue, but rather an object design issue.&#160; So I decided to whip up a quick and dirty solution to solve this particular issue.</p>
<p>The approach I am going to take is to simply keep track of the parent collection from within the POCO object itself.&#160; I really like interfaces, so I started out by defining a simple interface my POCOs will implement.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:529a9bc1-603c-4055-8ca9-4d919906a746" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> <span style="color:#0000ff">interface</span> <span style="color:#2b91af">IHasParent</span><br /> {<br />     <span style="color:#0000ff">object</span> Parent { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; }<br /> }</div>
</p></div>
</p></div>
<p>Now let’s take a look at the simple POCO I will be using in this example.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:65d4cc86-7400-4989-b8ee-b7a14c796860" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 400px; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">Person</span> : <span style="color:#2b91af">INotifyPropertyChanged</span>, <span style="color:#2b91af">IDataErrorInfo</span><br /> {<br />     <span style="color:#0000ff">private</span> <span style="color:#0000ff">string</span> _firstName;<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> FirstName<br />     {<br />         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> _firstName; }<br />         <span style="color:#0000ff">set</span><br />         {<br />             _firstName = <span style="color:#0000ff">value</span>;<br />             OnPropertyChanged(<span style="color:#a31515">&quot;FirstName&quot;</span>);<br />         }<br />     }</p>
<p>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">string</span> _lastName;<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> LastName<br />     {<br />         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> _lastName; }<br />         <span style="color:#0000ff">set</span><br />         {<br />             _lastName = <span style="color:#0000ff">value</span>;<br />             OnPropertyChanged(<span style="color:#a31515">&quot;LastName&quot;</span>);<br />         }<br />     }</p>
<p>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">event</span> <span style="color:#2b91af">PropertyChangedEventHandler</span> PropertyChanged;<br />     <span style="color:#0000ff">protected</span> <span style="color:#0000ff">void</span> OnPropertyChanged(<span style="color:#0000ff">string</span> propertyName)<br />     {<br />         <span style="color:#0000ff">var</span> handler = PropertyChanged;<br />         <span style="color:#0000ff">if</span> (handler != <span style="color:#0000ff">null</span>)<br />             handler(<span style="color:#0000ff">this</span>, <span style="color:#0000ff">new</span> <span style="color:#2b91af">PropertyChangedEventArgs</span>(propertyName));<br />     }</p>
<p>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> <span style="color:#0000ff">this</span>[<span style="color:#0000ff">string</span> columnName]<br />     {<br />         <span style="color:#0000ff">get</span><br />         {<br />             <span style="color:#0000ff">if</span> (columnName == <span style="color:#a31515">&quot;FirstName&quot;</span>)<br />             {<br />                 <span style="color:#0000ff">if</span> (<span style="color:#2b91af">String</span>.IsNullOrWhiteSpace(FirstName))<br />                     <span style="color:#0000ff">return</span> <span style="color:#a31515">&quot;First name cannot be empty&quot;</span>;<br />             }</p>
<p>             <span style="color:#0000ff">if</span> (columnName == <span style="color:#a31515">&quot;LastName&quot;</span>)<br />             {<br />                 <span style="color:#0000ff">if</span> (<span style="color:#2b91af">String</span>.IsNullOrWhiteSpace(LastName))<br />                     <span style="color:#0000ff">return</span> <span style="color:#a31515">&quot;Last name cannot be empty&quot;</span>;<br />             }</p>
<p>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br />         }<br />     }</p>
<p>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> Error<br />     {<br />         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty; }<br />     }<br /> }</div>
</p></div>
</p></div>
<p>Notice that we implement both the INotifyPropertyChanged interfaces as well as the IDataErrorInfo interface.&#160; The Next thing we need is a custom ObservableCollection to use as our data source.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ff50d463-15c6-485f-985c-156a77efe0ab" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">HasParentObservableCollection</span>&lt;T&gt; : <span style="color:#2b91af">ObservableCollection</span>&lt;T&gt;<br /> {<br />     <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> InsertItem(<span style="color:#0000ff">int</span> index, T item)<br />     {<br />         <span style="color:#008000">//set the parent object when a new item is added to our collection</span><br />         <span style="color:#0000ff">if</span> (item != <span style="color:#0000ff">null</span> &amp;&amp; item <span style="color:#0000ff">is</span> <span style="color:#2b91af">IHasParent</span>)<br />             (item <span style="color:#0000ff">as</span> <span style="color:#2b91af">IHasParent</span>).Parent = <span style="color:#0000ff">this</span>;</p>
<p>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br />     }<br /> }</div>
</p></div>
</p></div>
<p>Notice that we are casting our item as the IHasParent interface and setting the Parent property accordingly.&#160; The next thing we need to do is have our POCO class implement the IHasPerson interface.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:86290b0b-8cad-4705-9067-dff871c468c6" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 500px; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">Person</span> : <span style="color:#2b91af">INotifyPropertyChanged</span>, <span style="color:#2b91af">IDataErrorInfo</span>, <span style="color:#2b91af">IHasParent</span><br /> {<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">object</span> Parent { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; }</p>
<p>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">string</span> _firstName;<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> FirstName<br />     {<br />         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> _firstName; }<br />         <span style="color:#0000ff">set</span><br />         {<br />             _firstName = <span style="color:#0000ff">value</span>;<br />             OnPropertyChanged(<span style="color:#a31515">&quot;FirstName&quot;</span>);<br />         }<br />     }</p>
<p>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">string</span> _lastName;<br />     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> LastName<br />     {<br />         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> _lastName; }<br />         <span style="color:#0000ff">set</span><br />         {<br />             _lastName = <span style="color:#0000ff">value</span>;<br />             OnPropertyChanged(<span style="color:#a31515">&quot;LastName&quot;</span>);<br />         }<br />     }</p>
<p>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">event</span> <span style="color:#2b91af">PropertyChangedEventHandler</span> PropertyChanged;<br />     <span style="color:#0000ff">protected</span> <span style="color:#0000ff">void</span> OnPropertyChanged(<span style="color:#0000ff">string</span> propertyName)<br />     {<br />         <span style="color:#0000ff">var</span> handler = PropertyChanged;<br />         <span style="color:#0000ff">if</span> (handler != <span style="color:#0000ff">null</span>)<br />             handler(<span style="color:#0000ff">this</span>, <span style="color:#0000ff">new</span> <span style="color:#2b91af">PropertyChangedEventArgs</span>(propertyName));<br />     }</p>
<p>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> <span style="color:#0000ff">this</span>[<span style="color:#0000ff">string</span> columnName]<br />     {<br />         <span style="color:#0000ff">get</span><br />         {<br />             <span style="color:#0000ff">if</span> (columnName == <span style="color:#a31515">&quot;FirstName&quot;</span>)<br />             {<br />                 <span style="color:#0000ff">if</span> (<span style="color:#2b91af">String</span>.IsNullOrWhiteSpace(FirstName))<br />                     <span style="color:#0000ff">return</span> <span style="color:#a31515">&quot;First name cannot be empty&quot;</span>;<br />             }</p>
<p>             <span style="color:#0000ff">if</span> (columnName == <span style="color:#a31515">&quot;LastName&quot;</span>)<br />             {<br />                 <span style="color:#0000ff">if</span> (<span style="color:#2b91af">String</span>.IsNullOrWhiteSpace(LastName))<br />                     <span style="color:#0000ff">return</span> <span style="color:#a31515">&quot;Last name cannot be empty&quot;</span>;</p>
<p>                 <span style="color:#0000ff">if</span> (Parent != <span style="color:#0000ff">null</span> &amp;&amp; Parent <span style="color:#0000ff">is</span> <span style="color:#2b91af">IList</span>&lt;<span style="color:#2b91af">Person</span>&gt;)<br />                 {<br />                     <span style="color:#0000ff">var</span> list = (<span style="color:#2b91af">IList</span>&lt;<span style="color:#2b91af">Person</span>&gt;) Parent;<br />                     <span style="color:#0000ff">if</span> (list.Count(x =&gt; x.LastName == LastName) &gt; 1)<br />                         <span style="color:#0000ff">return</span> <span style="color:#a31515">&quot;This last name already exists.  Please use a different last name.&quot;</span>;<br />                 }<br />             }</p>
<p>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br />         }<br />     }</p>
<p>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> Error<br />     {<br />         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty; }<br />     }<br /> }</div>
</p></div>
</p></div>
<p>Notice how we implemented the check for a duplicate last name.&#160; We simply checked to make sure we are dealing with the LastName property.&#160; Then we cast the Parent as an IList&lt;Person&gt; so that we can perform a simply LINQ query against it.&#160; We check the parent collection for any results that match the LastName property.&#160; If more than one is returned we have a duplicate.</p>
<p>So let’s test this baby using the XamDataGrid as the original poster was attempting to do.&#160; First create our UI.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5111c8ca-8ea5-4792-a525-912591885c8c" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px;"><span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">XamDataGrid</span><span style="color:#ff0000"> Name</span><span style="color:#0000ff">=&quot;xamDataGrid1&quot;&gt;</span><br />     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">XamDataGrid.FieldLayouts</span><span style="color:#0000ff">&gt;</span><br />         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">FieldLayout</span><span style="color:#0000ff">&gt;</span><br />             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">Field</span><span style="color:#ff0000"> Name</span><span style="color:#0000ff">=&quot;FirstName&quot;</span><span style="color:#ff0000"> Label</span><span style="color:#0000ff">=&quot;First Name&quot; /&gt;</span><br />             <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">Field</span><span style="color:#ff0000"> Name</span><span style="color:#0000ff">=&quot;LastName&quot;</span><span style="color:#ff0000"> Label</span><span style="color:#0000ff">=&quot;Last Name&quot; /&gt;</span><br />         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">FieldLayout</span><span style="color:#0000ff">&gt;</span><br />     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">XamDataGrid.FieldLayouts</span><span style="color:#0000ff">&gt;</span><br />     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">XamDataGrid.FieldLayoutSettings</span><span style="color:#0000ff">&gt;</span><br />         <span style="color:#a31515"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">FieldLayoutSettings</span><span style="color:#ff0000"> AddNewRecordLocation</span><span style="color:#0000ff">=&quot;OnTop&quot;</span><br />                                  <span style="color:#ff0000"> AllowAddNew</span><span style="color:#0000ff">=&quot;True&quot;</span> <br />                                  <span style="color:#ff0000"> AutoGenerateFields</span><span style="color:#0000ff">=&quot;False&quot;</span> <br />                                  <span style="color:#ff0000"> SupportDataErrorInfo</span><span style="color:#0000ff">=&quot;RecordsAndCells&quot;</span> <br />                                  <span style="color:#ff0000"> DataErrorDisplayMode</span><span style="color:#0000ff">=&quot;Highlight&quot; /&gt;</span><br />     <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">XamDataGrid.FieldLayoutSettings</span><span style="color:#0000ff">&gt;</span><br /> <span style="color:#a31515"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">igDP</span><span style="color:#0000ff">:</span><span style="color:#a31515">XamDataGrid</span><span style="color:#0000ff">&gt;</span></div>
</p></div>
</p></div>
<p>Next let’s hook up some data to this bad boy:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7d3714c7-ca40-46b3-a0a9-35ac8e656685" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt">
<div style="background-color: #ffffff; max-height: 300px; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> MainWindow()<br /> {<br />     InitializeComponent();</p>
<p>     <span style="color:#0000ff">var</span> people = <span style="color:#0000ff">new</span> <span style="color:#2b91af">HasParentObservableCollection</span>&lt;<span style="color:#2b91af">Person</span>&gt;();<br />     people.Add(<span style="color:#0000ff">new</span> <span style="color:#2b91af">Person</span>(){ FirstName = <span style="color:#a31515">&quot;Brian&quot;</span>, LastName = <span style="color:#a31515">&quot;Lagunas&quot;}</span>);<br />     xamDataGrid1.DataSource = people;<br /> }</div>
</p></div>
</p></div>
<p>Now let’s run the app, type a duplicate last name, and see what we get.</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2012/04/collection_validated.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="collection_validated" border="0" alt="collection_validated" src="http://elegantcode.com/wp-content/uploads/2012/04/collection_validated_thumb.jpg" width="644" height="315" /></a></p>
<p>Cool. Works as expected.&#160; Now there are a number of ways to accomplish this task.&#160; There are even frameworks out there that have already solved this problem for you such as <a href="http://www.lhotka.net/cslanet/" target="_blank">CSLA</a>.&#160; I hope this simple approach helps you find a solution that works for you.</p>
<p><a href="http://brianlagunas.com/wp-content/uploads/2012/04/validatepropertyagainstparentcollection.zip">Download the Source.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/04/11/validate-a-property-against-a-parent-collection/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Victor Gaudioso&#8211;Preserving his Contributions</title>
		<link>http://elegantcode.com/2012/04/06/victor-gaudiosopreserving-his-contributions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=victor-gaudiosopreserving-his-contributions</link>
		<comments>http://elegantcode.com/2012/04/06/victor-gaudiosopreserving-his-contributions/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 19:55:39 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Victor Gaudioso]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2012/04/06/victor-gaudiosopreserving-his-contributions/</guid>
		<description><![CDATA[It was Sunday night.&#160; Victor and I were having a video call on Skype finalizing our plans to host his 70+ Silverlight video tutorials on Xaml TV.&#160; He was late to our meeting because he said he didn’t feel well.&#160; He said that he was recovering from a week long illness, but he quickly assured [...]]]></description>
				<content:encoded><![CDATA[<p>It was Sunday night.&#160; Victor and I were having a video call on Skype finalizing our plans to host his 70+ Silverlight video tutorials on <a href="http://xaml.tv/" target="_blank">Xaml TV</a>.&#160; He was late to our meeting because he said he didn’t feel well.&#160; He said that he was recovering from a week long illness, but he quickly assured me he was feeling better.&#160; We chatted for awhile and then ended the meeting with some friendly banter like we always have in the past.</p>
<p>Sadly the next day, on the morning of Monday April 2, 2012, <a href="http://windowspresentationfoundation.com/" target="_blank">Victor Gaudioso</a> passed away.&#160; You didn’t have to know Victor long to know that he was passionate about his work and about his community.&#160; He always went the extra mile to help his fellow developer.&#160; I can write pages about all the good things he has done for his family, friends, and community, but instead I would like encourage you to share your memories of Victor.&#160; Think of how he has influenced you in your life.</p>
<p>The Sunday before he passed, Victor gave me 73 of his videos that we would be posting on Xaml TV.&#160; That night he posted 10 of his Microsoft Starter Kit videos.&#160; Unfortunately he passed before he could finish his effort.&#160; With the blessing of his family and the help of his community, we will be posting all 73 of Victor Gaudioso’s Silverlight video tutorials on Xaml TV.&#160; We will preserve his work and contributions that he made to the community.&#160; They will live on and not disappear with an expiring domain or hosting plan.&#160; His legacy will continue to grow as you remember the fond memories you have of him.</p>
<p>If you would like to help by donating to Victor’s memorial fund or to volunteer, please visit the <a href="http://www.meetup.com/LA-SLUG/pages/WE_LOVE_YOU_VICTOR/" target="_blank">Los Angeles Silverlight User Group</a> site.</p>
<p>Rest in peace my friend.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/04/06/victor-gaudiosopreserving-his-contributions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Awarded &#8211; Microsoft Community Contributor Award 2012</title>
		<link>http://elegantcode.com/2012/03/30/awarded-microsoft-community-contributor-award-2012/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=awarded-microsoft-community-contributor-award-2012</link>
		<comments>http://elegantcode.com/2012/03/30/awarded-microsoft-community-contributor-award-2012/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 23:03:17 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[awards]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2012/03/30/awarded-microsoft-community-contributor-award-2012/</guid>
		<description><![CDATA[Today I received an email informing me that I have been awarded the Microsoft Community Contributor Award.&#160; This is the second time I have been awarded this particular award and it feels just as good this time as it did last time.&#160; I’m not sure how you go about getting nominated for this award, but [...]]]></description>
				<content:encoded><![CDATA[<p>Today I received an email informing me that I have been awarded the Microsoft Community Contributor Award.&#160; This is the second time I have been awarded this particular award and it feels just as good this time as it did last time.&#160; I’m not sure how you go about getting nominated for this award, but apparently I am doing something right.</p>
<p>I would like to thank whoever nominated me for this award and Microsoft for listening to that person.&#160; I would most of all like to thank the community.&#160; Without the support of the community I would probably still be a cop. Oh, you probably didn’t know that about me.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Brian Lagunas awarded Microsoft Community Contributor Award" border="0" alt="Brian Lagunas awarded Microsoft Community Contributor Award" src="http://elegantcode.com/wp-content/uploads/2012/03/MCC12_Logo_Horizontal_Full-color.jpg" width="500" height="202" /></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2012/03/30/awarded-microsoft-community-contributor-award-2012/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
