<?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; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; Silverlight</title>
	<atom:link href="http://elegantcode.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Buy Retin-A Without Prescription</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[Buy Retin-A Without Prescription, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Buy Retin-A Without Prescription</b>, 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>.  Retin-A use.  Order Retin-A from mexican pharmacy.  Online Retin-A without a prescription.  Retin-A brand name.  Fast shipping Retin-A.  Retin-A cost.  Retin-A class.  Retin-A photos.  Retin-A natural.  Purchase Retin-A online.  Where can i order Retin-A without prescription.  Retin-A online cod.  Retin-A pharmacy.  Retin-A from canadian pharmacy.  Where can i find Retin-A online.  Retin-A steet value.  Where can i buy cheapest Retin-A online.  Generic Retin-A.  Retin-A long term.  Retin-A without a prescription.  Retin-A for sale.  Taking Retin-A.  Retin-A trusted pharmacy reviews.  Retin-A from mexico.  Retin-A pics.  Order Retin-A online overnight delivery no prescription.  Buy Retin-A online no prescription.  Retin-A steet value.  Retin-A description.  Order Retin-A from United States pharmacy.  Retin-A duration.  Where can i find Retin-A online.  Where can i cheapest Retin-A online.  No prescription Retin-A online.  Taking Retin-A.  Online buy Retin-A without a prescription.  Order Retin-A no prescription.  Effects of Retin-A.  Retin-A online cod.  Retin-A treatment.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4568'>Buy Acomplia Without Prescription</a>. <a href='http://elegantcode.com/?p=4399'>Periactin For Sale</a>. <a href='http://elegantcode.com/?p=4721'>Buy Flonase Without Prescription</a>. <a href='http://elegantcode.com/?p=4234'>Buy Periactin Without Prescription</a>. <a href='http://elegantcode.com/?p=4203'>Buy Armour Without Prescription</a>. <a href='http://elegantcode.com/?p=4302'>Phenergan wiki</a>. <a href='http://elegantcode.com/?p=4268'>Soma maximum dosage</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax treatment</a>. <a href='http://elegantcode.com/?p=4578'>Cialis price, coupon</a>. <a href='http://elegantcode.com/?p=4189'>Flexeril price</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.themusclecarplace.com/?p=5610'>Buy Retin-A Without Prescription</a>. <a href='http://changecamp.ca/?p=603'>Buy Retin-A Without Prescription</a>. <a href='http://linuxologist.com/?p=2089'>Buy Retin-A Without Prescription</a>. <a href='http://www.rideriseroar.com/?p=133'>Buy Retin-A Without Prescription</a>. <a href='http://blog.farmland.org/?p=4178'>Buy Retin-A Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3533'>Retin-A wiki</a>. <a href='http://4realz.net/?p=2743'>Rx free Retin-A</a>. <a href='http://tvtownhall.com/?p=1918'>Buying Retin-A online over the counter</a>. <a href='http://reversemortgagedaily.com/?p=14847'>Retin-A online cod</a>. <a href='http://home.officesnapshots.com/?p=375'>Retin-A canada, mexico, india</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>Amoxicillin For Sale</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[Amoxicillin For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Amoxicillin For Sale</b>, 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>.  Amoxicillin alternatives.  Amoxicillin dangers.  Amoxicillin schedule.  Amoxicillin for sale.  Is Amoxicillin safe.  Australia, uk, us, usa.  Amoxicillin forum.  Amoxicillin overnight.  Cheap Amoxicillin no rx.  Online Amoxicillin without a prescription.  Amoxicillin dosage.  Canada, mexico, india.  About Amoxicillin.  Order Amoxicillin from mexican pharmacy.  Amoxicillin images.  Amoxicillin class.  Amoxicillin long term.  Amoxicillin samples.  Online buying Amoxicillin hcl.  Where can i buy cheapest Amoxicillin online.  Amoxicillin from mexico.  Amoxicillin cost.  Amoxicillin from canada.  Generic Amoxicillin.  Buy cheap Amoxicillin no rx.  Amoxicillin recreational.  Purchase Amoxicillin online.  Amoxicillin maximum dosage.  Buy cheap Amoxicillin.  Where can i order Amoxicillin without prescription.  Buying Amoxicillin online over the counter.  Amoxicillin without prescription.  Amoxicillin used for.  After Amoxicillin.  Buy Amoxicillin without prescription.  Amoxicillin brand name.  Real brand Amoxicillin online.  Amoxicillin australia, uk, us, usa.  Amoxicillin from canadian pharmacy.  Fast shipping Amoxicillin.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4899'>Buy Macrobid Without Prescription</a>. <a href='http://elegantcode.com/?p=4534'>Xalatan For Sale</a>. <a href='http://elegantcode.com/?p=4197'>Buy Diflucan Without Prescription</a>. <a href='http://elegantcode.com/?p=4459'>Buy Avodart Without Prescription</a>. <a href='http://elegantcode.com/?p=4411'>Buy Prednisolone Without Prescription</a>. <a href='http://elegantcode.com/?p=4522'>Order Flonase from United States pharmacy</a>. <a href='http://elegantcode.com/?p=4758'>Purchase Atenolol online</a>. <a href='http://elegantcode.com/?p=4460'>Proscar overnight</a>. <a href='http://elegantcode.com/?p=4423'>Where can i cheapest Antabuse online</a>. <a href='http://elegantcode.com/?p=5060'>Methotrexate forum</a>.<br />
<b>Trackbacks from:</b> <a href='http://home.officesnapshots.com/?p=373'>Amoxicillin For Sale</a>. <a href='http://reversemortgagedaily.com/?p=14827'>Amoxicillin For Sale</a>. <a href='http://social-blend.com/?p=1325'>Amoxicillin For Sale</a>. <a href='http://tvtownhall.com/?p=1960'>Amoxicillin For Sale</a>. <a href='http://www.quarterlives.com/?p=1287'>Amoxicillin For Sale</a>. <a href='http://evanrapoport.com/?p=950'>Amoxicillin dose</a>. <a href='http://www.rideriseroar.com/?p=128'>Generic Amoxicillin</a>. <a href='http://nysccc.org/?p='>Herbal Amoxicillin</a>. <a href='http://www.themusclecarplace.com/?p=5635'>Amoxicillin street price</a>. <a href='http://www.thegriffonnews.com/?p=10642'>Where can i order Amoxicillin without prescription</a>.</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>Buy Flagyl Without Prescription</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) Buy Flagyl Without Prescription, Well, what happens when you want to use a different control as a region host?&#160; Simple.&#160; You need to write a [...]]]></description>
			<content:encoded><![CDATA[<p> <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> <b>Buy Flagyl Without Prescription</b>, 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>     {<br> <br>     }<br> <br>     <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>                 }<br> <br>                 <span style="color:#008000">//implement remove</span><br>             };<br>     }<br> <br>     <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> </div> </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', <b>kjøpe Flagyl på nett, köpa Flagyl online</b>, <b>Is Flagyl addictive</b>, 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>), <b>Flagyl dose</b>, <b>Buy generic Flagyl</b>, Container.Resolve&lt;<span style="color:#2b91af">StackPanelRegionAdapter</span>&gt;());<br>     <span style="color:#0000ff">return</span> mappings;<br> }</div> </div> </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, <b>Flagyl natural</b>, <b>Flagyl coupon</b>, 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> </div> </div>  <p>&#160;</p>  <p><a href="http://brianlagunas.com/downloads/source/prism-custom-region-adapter.zip">Download the sample application.</a></p>.  Order Flagyl online c.o.d.  Ordering Flagyl online.  Purchase Flagyl for sale.  Buy Flagyl from mexico.  Herbal Flagyl.  Fast shipping Flagyl.  Flagyl description.  Buy Flagyl online no prescription.  Generic Flagyl.  Buy cheap Flagyl.  Ordering Flagyl online.  My Flagyl experience.  Where can i find Flagyl online.  Is Flagyl addictive.  Flagyl no prescription.  Order Flagyl from mexican pharmacy.  Buy generic Flagyl.  Buy Flagyl online cod.  Flagyl coupon.  Buy cheap Flagyl no rx.  Flagyl recreational.  Flagyl pics.  Flagyl price.  Get Flagyl.  Low dose Flagyl.  Flagyl duration.  Flagyl from mexico.  Flagyl dosage.  Doses Flagyl work.  Flagyl without a prescription.  Flagyl maximum dosage.  Canada, mexico, india.  Comprar en línea Flagyl, comprar Flagyl baratos.  Where can i buy Flagyl online.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4758'>Buy Atenolol Without Prescription</a>. <a href='http://elegantcode.com/?p=4553'>Buy Female Pink Viagra Without Prescription</a>. <a href='http://elegantcode.com/?p=4560'>Vermox For Sale</a>. <a href='http://elegantcode.com/?p=4432'>Buy Erythromycin Without Prescription</a>. <a href='http://elegantcode.com/?p=4781'>Lasix For Sale</a>. <a href='http://elegantcode.com/?p=4234'>Periactin online cod</a>. <a href='http://elegantcode.com/?p=4311'>Topamax overnight</a>. <a href='http://elegantcode.com/?p=4755'>Zovirax natural</a>. <a href='http://elegantcode.com/?p=4700'>Get Inderal</a>. <a href='http://elegantcode.com/?p=4983'>Cheap Prozac</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10585'>Buy Flagyl Without Prescription</a>. <a href='http://www.independentworldreport.com/?p=2637'>Buy Flagyl Without Prescription</a>. <a href='http://evanrapoport.com/?p=922'>Buy Flagyl Without Prescription</a>. <a href='http://www.themusclecarplace.com/?p=5538'>Buy Flagyl Without Prescription</a>. <a href='http://changecamp.ca/?p=600'>Buy Flagyl Without Prescription</a>. <a href='http://www.leaduganda.org/?p=3510'>Online buy Flagyl without a prescription</a>. <a href='http://4realz.net/?p=2649'>Online buying Flagyl hcl</a>. <a href='http://tvtownhall.com/?p=1906'>Is Flagyl addictive</a>. <a href='http://reversemortgagedaily.com/?p=14807'>About Flagyl</a>. <a href='http://linuxologist.com/?p=1821'>Buy cheap Flagyl no rx</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>Retin-A For Sale</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[Retin-A For Sale, 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 [...]]]></description>
			<content:encoded><![CDATA[<p> <p> <b>Retin-A For Sale</b>, 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> </div> </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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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>;<br> <br>         <span style="color:#0000ff">base</span>.InsertItem(index, item);<br>     }<br> }</div> </div> </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>; }<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>     }<br> <br>     <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>     }<br> <br>     <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>     }<br> <br>     <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>             }<br> <br>             <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> <br>                 <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>             }<br> <br>             <span style="color:#0000ff">return</span> <span style="color:#2b91af">String</span>.Empty;<br>         }<br>     }<br> <br>     <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> </div> </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> </div> </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();<br> <br>     <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> </div> </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>, <b>Retin-A used for</b>.  Retin-A wiki.  Retin-A dangers.  Where can i order Retin-A without prescription.  Order Retin-A online overnight delivery no prescription.  Effects of Retin-A.  Buy Retin-A from canada.  Retin-A pictures.  Online buy Retin-A without a prescription.  Cheap Retin-A no rx.  Retin-A images.  Real brand Retin-A online.  Retin-A pharmacy.  Retin-A over the counter.  Herbal Retin-A.  What is Retin-A.  Where to buy Retin-A.  Retin-A mg.  Retin-A price, coupon.  Retin-A dose.  Retin-A from canadian pharmacy.  Buy Retin-A no prescription.  Purchase Retin-A for sale.  Retin-A use.  Retin-A blogs.  Retin-A trusted pharmacy reviews.  Online Retin-A without a prescription.  Retin-A forum.  Retin-A long term.  Purchase Retin-A.  Retin-A samples.  Japan, craiglist, ebay, overseas, paypal.  Discount Retin-A.  Where can i buy cheapest Retin-A online.  Retin-A schedule.  Order Retin-A no prescription.  Retin-A class.  Retin-A alternatives.  Retin-A no rx.  Buy Retin-A without prescription.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4307'>Buy Toradol Without Prescription</a>. <a href='http://elegantcode.com/?p=4308'>Buy Cipro Without Prescription</a>. <a href='http://elegantcode.com/?p=4240'>Buy Combivent Without Prescription</a>. <a href='http://elegantcode.com/?p=5015'>Human Growth Hormone For Sale</a>. <a href='http://elegantcode.com/?p=4561'>Buy Modalert Without Prescription</a>. <a href='http://elegantcode.com/?p=4420'>What is Wellbutrin SR</a>. <a href='http://elegantcode.com/?p=4291'>Japan, craiglist, ebay, overseas, paypal</a>. <a href='http://elegantcode.com/?p=4699'>Buy cheap Metronidazole Gel</a>. <a href='http://elegantcode.com/?p=4843'>Buy Atenolol from mexico</a>. <a href='http://elegantcode.com/?p=4328'>Plavix treatment</a>.<br />
<b>Trackbacks from:</b> <a href='http://social-blend.com/?p=1287'>Retin-A For Sale</a>. <a href='http://tvtownhall.com/?p=1900'>Retin-A For Sale</a>. <a href='http://www.quarterlives.com/?p=1243'>Retin-A For Sale</a>. <a href='http://4realz.net/?p=2522'>Retin-A For Sale</a>. <a href='http://tayloegray.com/?p=412'>Retin-A For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3984'>Retin-A interactions</a>. <a href='http://www.macneilbmx.com/blog/?p=6906'>Generic Retin-A</a>. <a href='http://changecamp.ca/?p=599'>Retin-A wiki</a>. <a href='http://www.independentworldreport.com/?p=2625'>Real brand Retin-A online</a>. <a href='http://blog.farmland.org/?p=4131'>Retin-A dose</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>Cephalexin For Sale</title>
		<link>http://elegantcode.com/2011/11/04/free-prism-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=free-prism-training</link>
		<comments>http://elegantcode.com/2011/11/04/free-prism-training/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 04:23:40 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows phone 7]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/11/04/free-prism-training/</guid>
		<description><![CDATA[I am excited to announce that Pluralsight and Microsoft’s Patterns &#38; Practices Cephalexin For Sale, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &#38; Practices team.&#160; I know [...]]]></description>
			<content:encoded><![CDATA[<p> <p>I am excited to announce that <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> and <a href="http://msdn.microsoft.com/en-us/practices/bb190332" target="_blank">Microsoft’s Patterns &amp; Practices</a> <b>Cephalexin For Sale</b>, team have joined forces to provide you with free access to over 4 hours of online Prism training.&#160; That’s right, you heard me correctly. FREE online Prism training sponsored by the one and only Patterns &amp; Practices team.&#160; I know you have some question so let me answer the most common:</p>  <h4>Q &amp; A</h4>  <p><strong>Q1, <b>after Cephalexin</b>.  <b>Cephalexin price</b>, When is this free training available?</strong>     <br />A1. The entire weekend of Nov 12th 2011 through Nov 14th 2011.</p>  <p><strong>Q2, <b>ordering Cephalexin online</b>.  <b>Cephalexin class</b>, Do I have to be a Pluralsight subscriber to get this awesome training?</strong>     <br />A2. This training will be freely available to everyone, <b>Cephalexin For Sale</b>. You do not have to be a subscriber.</p>  <p><strong>Q3, <b>Cephalexin alternatives</b>.  <b>Cephalexin wiki</b>, What does the course cover?</strong>     <br />A3. Well let’s take a look:</p>  <ul>   <li>Getting started with Prism </li>    <li>Bootstrapper and Shell </li>    <li>Regions </li>    <li>Modules </li>    <li>Views </li>    <li>Communication </li>    <li>State-Based Navigation </li>    <li>View-Based Navigation </li> </ul>  <p><a href="http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=prism-introduction" target="_blank"><em>More course information.</em></a></p>  <p><strong>Q4, <b>Cephalexin samples</b>.  <b>Order Cephalexin from mexican pharmacy</b>, Who is the author of this kick ass Prism course?</strong>     <br />Q4.  That would be me.</p>  <p><strong> <b>Cephalexin For Sale</b>, Q5. Is it really free?</strong>     <br />Q5, <b>buy Cephalexin online cod</b>.  <b>Herbal Cephalexin</b>, You’re kidding right. Didn’t I already cover this part, <b>about Cephalexin</b>.  <b>Cephalexin natural</b>, Yes, it is free.</p>  <h4>New and Improved</h4>  <p>If you are a subscriber and have already watched the course, <b>Cephalexin trusted pharmacy reviews</b>, <b>Cephalexin description</b>, I would like to bring to your attention that there have been two new modules added.&#160; These modules will cover everything you need to know in order to start using the navigation services provided by Prism.&#160; This includes state-based navigation and view-based navigation.</p>  <p>Mark your calendar for Nov 12th and be sure to cram as much Prism knowledge into your brain as you can before the weekend ends.&#160; Don’t worry, if you run out of time you can always ask me questions directly.&#160; You can contact me either through Twitter (@<a href="http://twitter.com/brianlagunas" target="_blank">brianlagunas</a>) or through the <a href="http://wpftoolkit.codeplex.com/" target="_blank">Extended WPF Toolkit</a> project site.&#160; I hope you enjoy the training.</p>, <b>Cephalexin images</b>.  Cephalexin maximum dosage.  Generic Cephalexin.  Cephalexin no rx.  Where can i buy cheapest Cephalexin online.  Cephalexin steet value.  Cephalexin pics.  Cephalexin cost.  Cephalexin treatment.  Low dose Cephalexin.  Buying Cephalexin online over the counter.  My Cephalexin experience.  Comprar en línea Cephalexin, comprar Cephalexin baratos.  Is Cephalexin safe.  Cephalexin from canadian pharmacy.  Cephalexin long term.  Cephalexin without a prescription.  Cheap Cephalexin no rx.  Discount Cephalexin.  Cephalexin australia, uk, us, usa.  Cephalexin dangers.  Cephalexin natural.  Cephalexin price, coupon.  Cephalexin images.  Cephalexin pictures.  Buy Cephalexin from canada.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4744'>Buy Flexeril Without Prescription</a>. <a href='http://elegantcode.com/?p=4587'>Buy Pristiq Without Prescription</a>. <a href='http://elegantcode.com/?p=4732'>Abilify For Sale</a>. <a href='http://elegantcode.com/?p=4757'>Buy Abilify Without Prescription</a>. <a href='http://elegantcode.com/?p=4602'>Zovirax For Sale</a>. <a href='http://elegantcode.com/?p=4713'>Buy cheap Colchicine no rx</a>. <a href='http://elegantcode.com/?p=5158'>Order Retin-A no prescription</a>. <a href='http://elegantcode.com/?p=4781'>Buy Lasix online cod</a>. <a href='http://elegantcode.com/?p=4863'>Nasonex dose</a>. <a href='http://elegantcode.com/?p=4744'>Fast shipping Flexeril</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.quarterlives.com/?p=266'>Cephalexin For Sale</a>. <a href='http://4realz.net/?p=1997'>Cephalexin For Sale</a>. <a href='http://www.leaduganda.org/?p=975'>Cephalexin For Sale</a>. <a href='http://www.macneilbmx.com/blog/?p=4824'>Cephalexin For Sale</a>. <a href='http://www.greatgreengoods.com/?p=3764'>Cephalexin For Sale</a>. <a href='http://social-blend.com/?p=1176'>Cephalexin online cod</a>. <a href='http://www.independentworldreport.com/?p=151'>Cephalexin alternatives</a>. <a href='http://blog.farmland.org/?p=4112'>Cephalexin pics</a>. <a href='http://reversemortgagedaily.com/?p=14060'>Cephalexin samples</a>. <a href='http://linuxologist.com/?p=203'>Cephalexin mg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/11/04/free-prism-training/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>geekSpeak: Local Messaging and Silverlight on Channel9</title>
		<link>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geekspeak-local-messaging-and-silverlight-on-channel9</link>
		<comments>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:31:58 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[geekspeak]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/</guid>
		<description><![CDATA[For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure. http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/ And yes, I did give Elegant Code some love on the show.]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not get to see the “Local Messaging and Silverlight” geekSpeak webcast live, it has been posted on Channel9 for your viewing pleasure.</p>  <p><a title="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/" href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/">http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Local-Messaging-and-Silverlight-with-Brian-Lagunas/</a></p>  <p>And yes, I did give Elegant Code some love on the show.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/geekspeak-local-messaging-and-silverlight-on-channel9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NETDUG: Silverlight Bing Maps Sample Code</title>
		<link>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netdug-silverlight-bing-maps-sample-code</link>
		<comments>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 00:24:09 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[NETDUG]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[bing maps]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/</guid>
		<description><![CDATA[Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here: Get the Bing Maps Silverlight Control Get a Bing Maps API Key Play with the Bing Maps interactive SDK Application Read the Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who attended last weeks NETDUG presentations. For those of you who would like to get started right away with Bing Maps in your Silverlight applications, you can start here:</p>  <ul>   <li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=beb29d27-6f0c-494f-b028-1e0e3187e830" target="_blank">Get the Bing Maps Silverlight Control</a> </li>    <li><a href="https://www.bingmapsportal.com/" target="_blank">Get a Bing Maps API Key</a> </li>    <li><a href="http://www.microsoft.com/maps/isdk/silverlight/default.htm" target="_blank">Play with the Bing Maps interactive SDK Application</a> </li>    <li><a href="http://www.bing.com/community/blogs/maps/" target="_blank">Read the Bing Maps blog</a> </li>    <li><a href="http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/threads" target="_blank">Check out the Bing Maps forum</a> </li> </ul>  <p>You can also get the source code to my presentation here:&#160; <a href="http://brianlagunas.com/downloads/presentations/BingMapsSilverlightSamples.zip">Download the source</a>.</p>  <p><em><strong>Note</strong>: You will need to download the Bing Maps Silverlight control and re-reference the DLLs before the source will compile.&#160; Also, you have to have a Bing Maps API key in order to use any of the geocoding service examples.</em></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/07/17/netdug-silverlight-bing-maps-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4: Implicit Themes and a Sneak Peek</title>
		<link>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-4-implicit-themes-and-a-sneak-peek</link>
		<comments>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:26:34 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[implicit themes]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/</guid>
		<description><![CDATA[One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this: &#60;UserControl.Resources&#62; &#60;Style x:Key=&#34;myButtonStyle&#34; TargetType=&#34;Button&#34;&#62; &#60;Setter Property=&#34;Background&#34; Value=&#34;Blue&#34; /&#62; &#60;Setter Property=&#34;Foreground&#34; Value=&#34;Green&#34; /&#62; &#60;Setter Property=&#34;FontSize&#34; Value=&#34;24&#34; /&#62; &#60;/Style&#62; &#60;/UserControl.Resources&#62; Then, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my major gripes with Silverlight 3 is the inability to theme your application.&#160; Currently if you want to style a button for your application you will have to define a style similar to this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Then, you have to set the Style property on the Button control you want to apply the style to:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>Now, what if I want to apply that same style to every button in my application?&#160; Well I would have to go and find every single button in my application and set the Style property accordingly.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>

<p>How many buttons are in your application?&#160; What a pain in the you know what.&#160; Well not anymore.&#160; New in Silverlight 4 will be the ability to set your styles implicitly.&#160; What does this mean?&#160; It means that you can now declare your style, give it a TargetType, and exclude the x:Key; then it will apply that style to any instance of the TargetType control type.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Blue&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Green&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl.Resources</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Notice that I don’t need to set the Style property on my button controls individually anymore.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image11.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="implicit theming" border="0" alt="implicit theming" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb11.png" width="248" height="72" /></a> </p>

<p>Well what if I have a style that I want to implicitly use, but I have this one special button that I want to give a different style?&#160; Well in that case, just create a new Style and give it a x:Key, then set the Style property on your control.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Style</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;myOtherButtonStyle&quot;</span> <span style="color: #ff0000">TargetType</span><span style="color: #0000ff">=&quot;Button&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Background&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Orange&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;Foreground&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;Red&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   <span style="color: #0000ff">&lt;</span><span style="color: #800000">Setter</span> <span style="color: #ff0000">Property</span><span style="color: #0000ff">=&quot;FontSize&quot;</span> <span style="color: #ff0000">Value</span><span style="color: #0000ff">=&quot;12&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Style</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 1&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 2&quot;</span> <span style="color: #ff0000">Style</span><span style="color: #0000ff">=&quot;{StaticResource myOtherButtonStyle}&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Button 3&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
  </div>
</div>
<a href="http://elegantcode.com/wp-content/uploads/2010/03/image12.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="special style" border="0" alt="special style" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb12.png" width="248" height="63" /></a> 

<p>Now, your special button will use your new style, and all others will remain themed.</p>

<h2>Sneak Peek: Silverlight Application Themes</h2>

<p><a href="http://timheuer.com/blog/archive/2010/03/11/silverlight-application-theme-preview-sneak-peek-template.aspx" target="_blank">Tim Heuer</a> has recently given us a preview of three new theme packs coming to Silverlight.</p>

<h4>“GrayScale”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GrayScale Theme" border="0" alt="GrayScale Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/grayscalesampleapp_thumb.jpg" width="248" height="152" /></a> </p>

<h4>“Windows Theme”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows Theme" border="0" alt="Windows Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/winthemesampleapp_thumb.jpg" width="248" height="168" /></a> </p>

<h4>“Metro”</h4>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp.jpg" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Metro Theme" border="0" alt="Metro Theme" src="http://elegantcode.com/wp-content/uploads/2010/03/whitesampleapp_thumb.jpg" width="248" height="159" /></a></p>

<p>Thanks Tim!</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/12/silverlight-4-implicit-themes-and-a-sneak-peek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight DataGrid &#8211; Populate Dynamic Columns from a Child Collection</title>
		<link>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-datagrid-populate-dynamic-columns-from-a-child-collection</link>
		<comments>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:56:03 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[dynamic columns]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/</guid>
		<description><![CDATA[Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, any one building LOB (line of business) applications know that their users love Microsoft Excel.&#160; If the users had their way, they would do everything in Excel.&#160; Due to this known fact, when building Silverlight LOB applications, there is often a need to flatten out an object for editing in a grid.&#160; For example; you may have an object that has an<em> n</em>-level number of properties or attributes that aren’t known until runtime, but you want to edit the object in a single row in a grid. You don’t want to add a bunch of properties on your object like Prop1, Prop2, Prop3, etc.., just so you can bind it to your grid.&#160; You want to dynamically add columns to your grid and bind those columns to the correct object in the child collection at run time.</p>  <p>Well, this is much easier than you may think and I will show you how to accomplish this with just a few simple helper methods, and you can use any grid of your choice.&#160; For this example, I will be using the DataGrid that comes with the <a href="http://www.codeplex.com/Silverlight" target="_blank">Silverlight Toolkit</a>. Make sure you download and install it, because I am not including the System.Windows.Controls.Data assembly required for the DataGrid.</p>  <p>It will be located at c:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.Data.dll</p>  <p>In my scenario I am building a staffing application and I have a “StaffMember” object that has a collection of “Period” objects as a child property.&#160; My objects look something like this:</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> StaffMember</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Department { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> ObservableCollection&lt;Period&gt; Periods { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Period</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Title { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> Hours { get; set; }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Pretty simple!&#160; now, lets create our DataGrid that will show our data for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">=&quot;SilverlightApplication1.MainPage&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:grid</span><span style="color: #0000ff">=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:d</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">xmlns:mc</span><span style="color: #0000ff">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> </pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">             <span style="color: #ff0000">mc:Ignorable</span><span style="color: #0000ff">=&quot;d&quot;</span> <span style="color: #ff0000">d:DesignWidth</span><span style="color: #0000ff">=&quot;640&quot;</span> <span style="color: #ff0000">d:DesignHeight</span><span style="color: #0000ff">=&quot;480&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">grid:DataGrid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;dataGrid&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Okay, now I don’t know how many Periods my StaffMember will have until I get the data back from the database at run time.&#160; For demonstration purposes, I just created a method on my StaffMember class that would create my objects by iterating through a loop.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;StaffMember&gt; GetData()</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    List&lt;StaffMember&gt; dataList = <span style="color: #0000ff">new</span> List&lt;StaffMember&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 3; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        StaffMember member = <span style="color: #0000ff">new</span> StaffMember { Name = String.Format(<span style="color: #006080">&quot;Name#{0}&quot;</span>, i), Department = String.Format(<span style="color: #006080">&quot;Department#{0}&quot;</span>, i) };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ObservableCollection&lt;Period&gt; periods = <span style="color: #0000ff">new</span> ObservableCollection&lt;Period&gt;();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; 5; j++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            periods.Add(<span style="color: #0000ff">new</span> Period() { Title = String.Format(<span style="color: #006080">&quot;Period#{0}-{1}&quot;</span>, i, j), Hours = j });</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        member.Periods = periods;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        dataList.Add(member);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now, we need to set the datasource on the DataGrid.&#160; Since we are creating the columns at runtime make sure you set AutoGenerateColumns to false;</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">List&lt;StaffMember&gt; dataList = StaffMember.GetData();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.AutoGenerateColumns = <span style="color: #0000ff">false</span>;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.ItemsSource = dataList;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Clear();</pre>
  </div>
</div>

<p>Next, lets take care of creating the easy columns first.&#160; I created a method that its’ sole purpose is to give me new DataGridTextColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> DataGridTextColumn CreateTextColumn(<span style="color: #0000ff">string</span> fieldName, <span style="color: #0000ff">string</span> title)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTextColumn column = <span style="color: #0000ff">new</span> DataGridTextColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = title;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Binding = <span style="color: #0000ff">new</span> System.Windows.Data.Binding(fieldName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Using this method we can create our first two columns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Name&quot;</span>, <span style="color: #006080">&quot;Staff Name&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">dataGrid.Columns.Add(CreateTextColumn(<span style="color: #006080">&quot;Department&quot;</span>, <span style="color: #006080">&quot;Company Department&quot;</span>));</pre>
  </div>
</div>

<p>Your DataGrid should now look something like this.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image9.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="text columns added to grid" border="0" alt="text columns added to grid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb9.png" width="244" height="114" /></a> </p>

<p>Now we need to create our columns based off the Periods collection.&#160; To do this we will utilize a DataGridTemplateColumn.&#160; The first thing we need to do is create a method that will dynamically create a DataTemplate that the DataGridTemplateColumn will use as the CellTemplate.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBlock Text='{{Binding Periods[{0}].{1}}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>What I am doing here is using a StringBuilder to create a DataTemplate, represented by XAML.&#160; Pay special attention to the TextBlock’s binding.&#160; I am using String.Format to create my binding string base off the index the of the object in the collection and the name of the property on the child object I want to bind to.&#160; Now, lets create our template that will be used for editing.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">string</span> CreateColumnEditTemplate(<span style="color: #0000ff">int</span> index, <span style="color: #0000ff">string</span> propertyName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    StringBuilder CellTemp = <span style="color: #0000ff">new</span> StringBuilder();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;DataTemplate &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns='http://schemas.microsoft.com/winfx/&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;2006/xaml/presentation' &quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(String.Format(<span style="color: #006080">&quot;&lt;TextBox Text='{{Binding Periods[{0}].{1}, Mode=TwoWay}}'/&gt;&quot;</span>, index, propertyName));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    CellTemp.Append(<span style="color: #006080">&quot;&lt;/DataTemplate&gt;&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> CellTemp.ToString();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p></p>

<p>This method is very similar to the previous one we wrote, but notice the subtle difference; I am using a TextBox instead of a TextBlock, and the Mode is set to TwoWay.&#160; This will allow us to edit the values in the DataGrid.&#160; Now we need a method that will actually create the TemplateColumns.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> DataGridTemplateColumn CreateTemplateColumn(<span style="color: #0000ff">int</span> i, <span style="color: #0000ff">string</span> propName)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DataGridTemplateColumn column = <span style="color: #0000ff">new</span> DataGridTemplateColumn();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.Header = String.Format(<span style="color: #006080">&quot;Period#{0}.{1}&quot;</span>, i, propName);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellTemplate = (DataTemplate)XamlReader.Load(CreateColumnTemplate(i, propName)); <span style="color: #008000">//display template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    column.CellEditingTemplate = (DataTemplate)XamlReader.Load(CreateColumnEditTemplate(i, propName)); <span style="color: #008000">//edit template</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> column;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Notice that we are setting the CellTemplate and CellEditTemplate by using the XamlReader to load our StringBuilder result and cast it as a legitimate DataTemplate the column can use.&#160; Now that we have the method that will create our TemplateColumns, lets go ahead and build our dynamic columns to the n-level.&#160; We do this by looping though the number of columns that need to be created and using our CreateTemplateColumn method to add the new columns to the DataGrid.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">int</span> periodCount = dataList[0].Periods.Count;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; periodCount; i++)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">   dataGrid.Columns.Add(CreateTemplateColumn(i, <span style="color: #006080">&quot;Hours&quot;</span>));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Now of course, in the real world you would not want to use the first index of the child collection to figure out how many columns to build.&#160; I would recommend some kind of definition object that will define what columns and how many columns to build.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image10.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="completed DataGrid" border="0" alt="completed DataGrid" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb10.png" width="244" height="101" /></a>&#160;</p>

<p>That is it.&#160; You have now successfully satisfied your customer’s addiction to Excel.&#160; Well, at least a little bit.</p>

<p></p>

<p></p>

<p><a href="http://brianlagunas.com/downloads/source/DynamicColumns.zip" target="_blank">Download Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Text-To-Speech in Silverlight Using WCF</title>
		<link>http://elegantcode.com/2010/03/07/text-to-speech-in-silverlight-using-wcf/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=text-to-speech-in-silverlight-using-wcf</link>
		<comments>http://elegantcode.com/2010/03/07/text-to-speech-in-silverlight-using-wcf/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 07:05:56 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[text to speech]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/03/07/text-to-speech-in-silverlight-using-wcf/</guid>
		<description><![CDATA[Back in February, I wrote a blog post showing you how to, using Silverlight 4 OOB (out of browser) with elevated trust, access system devices; including how to use the SAPI.SpVoice API through the new Silverlight 4 COM Interop feature to implement text to speech. The biggest problem to that approach is that it will [...]]]></description>
			<content:encoded><![CDATA[<p>Back in February, I wrote a <a href="http://elegantcode.com/2010/02/20/silverlight-4-com-interop-and-the-cool-stuff-you-can-do-with-it/" target="_blank">blog post</a> showing you how to, using Silverlight 4 OOB (out of browser) with elevated trust, access system devices; including how to use the <a href="http://msdn.microsoft.com/en-us/library/ms723602(VS.85).aspx" target="_blank">SAPI.SpVoice</a> API through the new Silverlight 4 COM Interop feature to implement text to speech. The biggest problem to that approach is that it will only work on the Windows platform. </p>  <p>So, I started thinking to myself, that the real purpose behind Text-To-Speech isn't just the cool factor, but it is accessibility for impaired users.&#160; I have been doing web development for nearly a decade, and I have always been conscious about web users with impairments that may make viewing or navigating my websites more difficult.&#160; Text-To-Speech isn’t very helpful if it will only work in a fully trusted out of browser Silverlight 4 application on a Windows machine. So instead, lets create a Text-To-Speech solution that will work inside the browser, on any browser, on any machine.&#160; And heck, I want this to be in Silverlight 3.</p>  <p>Lets get started by creating a new Silverlight 3 application, and be sure to include a web project as well.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image4.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="create new silverlight project" border="0" alt="create new silverlight project" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb4.png" width="248" height="222" /></a> </p>  <p>Right click the web project and add a reference to the System.Speech.dll.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image5.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="add reference to System.Speech" border="0" alt="add reference to System.Speech" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb5.png" width="245" height="248" /></a> </p>  <p>Next, lets right click the web project and click Properties –&gt; Web and set the specific port number to your liking, I set mine to 1914. This will come in handy when we create our WCF service. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image6.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="set port number" border="0" alt="set port number" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb6.png" width="248" height="101" /></a> </p>  <p>Now we need to create the WCF service that will take our text and send it back as a WAV stream, so go ahead and right click the web project and select “Add New Item”.&#160; From this list add a new WCF service and name is SpeechService.&#160; <strong>Now this is important</strong>; when you have created your WCF service an endpoint is created for you in the Web.config file.&#160; You need to change the binding of the endpoint to <strong>basicHttpBinding</strong>.&#160; Silverlight only works using basicHttpBinding, and will not create the ServiceReferences.ClientConfig file properly if you do not do this.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image7.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="change endpoint binding  to basicHttpBinding" border="0" alt="change endpoint binding  to basicHttpBinding" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb7.png" width="248" height="50" /></a> </p>  <p>Now, lets add an OperationCOntract to your WCF services interface called Speak that returns a byte[], and takes a string parameter.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">[ServiceContract]</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> ISpeechService</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    [OperationContract]</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">byte</span>[] Speak(<span style="color: #0000ff">string</span> textToSay);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>The implementation of this method will look like the following:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">byte</span>[] Speak(<span style="color: #0000ff">string</span> textToSay)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    SpeechSynthesizer ss = <span style="color: #0000ff">new</span> SpeechSynthesizer();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    MemoryStream ms = <span style="color: #0000ff">new</span> MemoryStream();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ss.SetOutputToWaveStream(ms);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ss.Speak(textToSay);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> ms.ToArray();</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>The next thing we need to do is create our UI in Silverlight.&#160; Here is what mine looks like.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Grid</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;LayoutRoot&quot;</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">TextBox</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;_txtTextToSay&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Button</span> <span style="color: #ff0000">Content</span><span style="color: #0000ff">=&quot;Speak To Me&quot;</span> <span style="color: #ff0000">Click</span><span style="color: #0000ff">=&quot;Button_Click&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">MediaElement</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">=&quot;_audioPlayer&quot;</span><span style="color: #0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">StackPanel</span><span style="color: #0000ff">&gt;</span></pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Grid</span><span style="color: #0000ff">&gt;</span></pre>
  </div>
</div>

<p>Create an event handler for your button.&#160; Next add a service reference to your SpeechService in your web project.</p>

<p><a href="http://elegantcode.com/wp-content/uploads/2010/03/image8.png" target="_blank"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="add service reference to your speechservice" border="0" alt="add service reference to your speechservice" src="http://elegantcode.com/wp-content/uploads/2010/03/image_thumb8.png" width="248" height="202" /></a> </p>

<p>The next part is somewhat complicated and time consuming.&#160; You have to write your own WAVV decoding class that takes the byte array that is return from the service and converts it to a <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.mediastreamsource(VS.95).aspx" target="_blank">System.Windows.Media.MediaStreamSource</a>. Luckily for you, I already did this for you with the help of some resources on MSDN.&#160; In the button’s event handler add this code:</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> Button_Click(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    SpeechServiceClient client = <span style="color: #0000ff">new</span> SpeechServiceClient(<span style="color: #006080">&quot;BasicHttpBinding_ISpeechService&quot;</span>);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    client.SpeakCompleted += (o, ea) =&gt;</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        {</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            WavMediaStreamSource audioStream = <span style="color: #0000ff">new</span> WavMediaStreamSource(<span style="color: #0000ff">new</span> MemoryStream(ea.Result));</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            _audioPlayer.SetSource(audioStream);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        };</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    client.SpeakAsync(_txtTextToSay.Text);</pre>

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
  </div>
</div>

<p>Basically what this does is uses the WavMediaStreamSource class I created that inherits from MediaStreamSource, takes the byte[] returned from the SpeechService and converts it back to a stream, then is passes it off to my WAV decoding classes, which is used as the source for the MediaElement responsible for playing the audio.</p>

<p>All that is next is to build your solution and start making your Silverlight applications more accessible.</p>

<p><a href="http://brianlagunas.com/downloads/source/SilverlightTextToSpeech.zip" target="_blank">Download the Source</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/07/text-to-speech-in-silverlight-using-wcf/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

