<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dan Wahlin&amp;#39;s WebLog</title><link>http://weblogs.asp.net/dwahlin/default.aspx</link><description>ASP.NET, AJAX, Silverlight, XML, and Web Services Exploration</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>What If I Don’t Call Dispose() on my LINQ to SQL DataContext Object?</title><link>http://weblogs.asp.net/dwahlin/archive/2008/08/19/what-if-i-don-t-call-dispose-on-my-linq-to-sql-datacontext-object.aspx</link><pubDate>Wed, 20 Aug 2008 05:51:33 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6541435</guid><dc:creator>dwahlin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6541435</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/08/19/what-if-i-don-t-call-dispose-on-my-linq-to-sql-datacontext-object.aspx#comments</comments><description>&lt;p&gt;I’ve written a &lt;a href="http://weblogs.asp.net/dwahlin/archive/tags/LINQ/default.aspx" target="_blank"&gt;few posts&lt;/a&gt; about LINQ to SQL and am generally a big fan of the technology (even with its weaknesses) since it’s very productive.&amp;#160; After creating a custom DataContext object using the LINQ to SQL designer (or one created by hand) I always ensure that the object is wrapped in a “using” statement so that the Dispose() method is called:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;(MyDataContext context = &lt;span style="color: blue"&gt;new &lt;/span&gt;MyDataContext())
{
&lt;br /&gt;    //Perform query
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;I had assumed that not properly disposing of the DataContext object would lead to orphan SQL connections which is of course bad and will likely lead to your DBA holding a grudge against you for life. :-)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/stephenwalther" target="_blank"&gt;Steven Walther&lt;/a&gt; recently posted on the subject of disposing of DataContext objects and provided some interesting insight into what actually happens.&amp;#160; From what he says it sounds like the DataContext object acts much like the SqlDataAdapter class.&amp;#160; It opens the connection right before a query is executed and closes it immediately after.&amp;#160; I don’t want to steal Steven’s thunder so check out his &lt;a href="http://weblogs.asp.net/stephenwalther/archive/2008/08/19/asp-net-mvc-tip-34-dispose-of-your-datacontext-or-don-t.aspx" target="_blank"&gt;post on the subject&lt;/a&gt; (the last part of the article talks about the consequences…or lack of consequences…of not calling Dispose()).&amp;#160; &lt;/p&gt;

&lt;p&gt;I haven’t had time to verify the details in Reflector yet, but given that Steven’s one of the more intelligent people I know I’m confident that the details he presents are accurate.&amp;#160; It still feels more correct to wrap “using” statements around any object that implements IDisposable or explicitly call Dispose() in my opinion, but it’s good to know how the DataContext object works behind the scenes.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6541435" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>My Latest Silverlight Articles</title><link>http://weblogs.asp.net/dwahlin/archive/2008/08/18/my-latest-silverlight-articles.aspx</link><pubDate>Tue, 19 Aug 2008 03:30:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4346912</guid><dc:creator>dwahlin</dc:creator><slash:comments>31</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=4346912</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/08/18/my-latest-silverlight-articles.aspx#comments</comments><description>&lt;P&gt;Over the past few months I've been writing articles for the &lt;A href="http://www.ftponline.com/" target=_blank mce_href="http://www.ftponline.com/"&gt;&lt;U&gt;&lt;FONT style="COLOR: #0066cc" color=#0066cc&gt;.NET Insight&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt; insight newsletter covering various ASP.NET AJAX concepts.&amp;nbsp; You can &lt;A href="http://weblogs.asp.net/dwahlin/archive/2007/09/18/latest-asp-net-ajax-articles.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2007/09/18/latest-asp-net-ajax-articles.aspx"&gt;&lt;U&gt;&lt;FONT style="COLOR: #0066cc" color=#0066cc&gt;read those article here&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;.&amp;nbsp; I've wrapped up that series and have started writing about Silverlight 1.0 and 2.&amp;nbsp; Each week (or so) a new article will be published and I'll update them here so check back.&amp;nbsp; The articles are designed to be focused and concise and get straight to the topic without a lot of fluff.&amp;nbsp; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;FONT style="COLOR: #0066cc" color=#0066cc&gt;&lt;U&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2285" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2285"&gt;Getting Started with Silverlight&lt;/A&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;FONT style="COLOR: #0066cc" color=#0066cc&gt;&lt;U&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2286" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2286"&gt;Using Microsoft's Silverlight Control in a Web Site&lt;/A&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;FONT style="COLOR: #0066cc" color=#0066cc&gt;&lt;U&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2315" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2315"&gt;Understanding Silverlight's createObject and createObjectEx Methods&lt;/A&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2374" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2374"&gt;&lt;FONT style="COLOR: #800080" color=#800080&gt;&lt;U&gt;Silverlight XAML Primer 1: Exploring Canvases&lt;/U&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2402" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2402"&gt;&lt;FONT style="COLOR: #800080" color=#800080&gt;&lt;U&gt;Silverlight XAML Primer 2: Rectangles, Ellipses, Lines and Text&lt;/U&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2409" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2409"&gt;&lt;U&gt;&lt;FONT style="COLOR: #800080" color=#800080&gt;Silverlight XAML Primer 3: Working with Image Brushes&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2417" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2417"&gt;&lt;U&gt;&lt;FONT style="COLOR: #0066cc" color=#0066cc&gt;Silverlight XAML Primer 4: Working with Linear Gradients&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2449" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2449"&gt;&lt;U&gt;&lt;FONT style="COLOR: #800080" color=#800080&gt;Silverlight XAML Primer 5: Working with Radial Gradients&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2455" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2455"&gt;&lt;FONT style="COLOR: #800080" color=#800080&gt;&lt;U&gt;Silverlight XAML Primer 6: Using Inline XAML with Silverlight&lt;/U&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2474" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2474"&gt;&lt;U&gt;&lt;FONT style="COLOR: #800080" color=#800080&gt;Silverlight XAML Primer 7: Embedding Media into Silverlight&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2488" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2488"&gt;Silverlight XAML Primer 8: Working with XAML Events&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2514" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2514"&gt;Silverlight XAML Primer 9: Using the Silverlight Downloader Object&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://www.ddj.com/windows/206901111?cid=RSSfeed_DDJ_All" target=_blank mce_href="http://www.ddj.com/windows/206901111?cid=RSSfeed_DDJ_All"&gt;Working with Events in Silverlight&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2527" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2527"&gt;Silverlight XAML Primer 10: Creating a Silverlight Downloader Progress Bar&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2530" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2530"&gt;Silverlight XAML Primer 11: Getting Started with Animations&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2556" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2556"&gt;Silverlight XAML Primer 12: Using Linear Keyframe Animations&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2572" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2572"&gt;Silverlight XAML Primer 13: Starting and Stopping Animations&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2605" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2605"&gt;Silverlight XAML Primer 14: Using Color Animations&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2619" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2619"&gt;Silverlight XAML Primer 15: Enhancing TextBlock with Runs and LineBreaks&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2546" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2546"&gt;Introducing Silverlight 2.0&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://www.ddj.com/windows/207402928?cid=RSSfeed_DDJ_All" target=_blank mce_href="http://www.ddj.com/windows/207402928?cid=RSSfeed_DDJ_All"&gt;Socket Support in Silverlight 2: Part I&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://www.ddj.com/windows/207602773?cid=RSSfeed_DDJ_All" target=_blank mce_href="http://www.ddj.com/windows/207602773?cid=RSSfeed_DDJ_All"&gt;Socket Support in Silverlight 2: Part II&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2644" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2644"&gt;Creating Your First Silverlight 2 Application&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2669" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2669"&gt;Getting Started with Silverlight 2 Controls&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2707" target=_blank&gt;Using Silverlight 2 Layout Controls&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2716" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2716"&gt;Using the StackPanel Control&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2746" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2746"&gt;Creating a Flyout StackPanel using Silverlight Animations&lt;/A&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A class="" href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2758" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2758"&gt;Using Silverlight's Grid Control&lt;/A&gt; (New!)&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you're interested in learning more about Silverlight 2.0 you can view &lt;A class="" href="http://weblogs.asp.net/dwahlin/archive/2008/03/07/silverlight-2-0-video-tutorials.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2008/03/07/silverlight-2-0-video-tutorials.aspx"&gt;8 video tutorials that I put together here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;A video of a talk I gave on integrating Silverlight 1.0 with ASP.NET AJAX and Web Services can be &lt;A class="" href="http://weblogs.asp.net/dwahlin/archive/2008/01/20/new-video-integrating-silverlight-and-asp-net-ajax.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2008/01/20/new-video-integrating-silverlight-and-asp-net-ajax.aspx"&gt;viewed here&lt;/A&gt; for those who are interested.&amp;nbsp; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need to display OrgCharts, site maps or other hierarchies in your ASP.NET applications?&amp;nbsp; Check out &lt;A href="http://www.smartwebcontrols.com/" target=_blank&gt;SmartChartPro&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.smartwebcontrols.com/" target=_blank&gt;&lt;IMG src="http://www.smartwebcontrols.com/images/smartchartprologo.gif" border=0&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4346912" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Using LINQ to SQL XML Mapping Files – Step by Step</title><link>http://weblogs.asp.net/dwahlin/archive/2008/08/18/using-linq-to-sql-xml-mapping-files-step-by-step.aspx</link><pubDate>Mon, 18 Aug 2008 07:20:51 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6534133</guid><dc:creator>dwahlin</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6534133</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/08/18/using-linq-to-sql-xml-mapping-files-step-by-step.aspx#comments</comments><description>&lt;p&gt;.NET 3.5’s LINQ to SQL functionality provides a great way to write data access layer code that automatically handles mapping relational data to object properties.&amp;#160; Although I generally prefer to use stored procedures when performing insert, update or delete operations against a database (see my &lt;a href="http://weblogs.asp.net/dwahlin/archive/2007/11/15/the-linq-dilemma.aspx" target="_blank"&gt;previous post&lt;/a&gt; on this), I still use LINQ to SQL in projects since it eliminates the time I used to spend creating SqlParameter objects or writing AddWithValue() parameter statements.&amp;#160; Overall, LINQ to SQL has made me much more productive as a developer.&lt;/p&gt;  &lt;p&gt;Most of the samples involving LINQ to SQL involve using the designer built-into Visual Studio 2008 since it’s very productive.&amp;#160; The LINQ to SQL designer is a great way to go and normally what I use when doing my ORM mapping.&amp;#160; I recently had someone ask if using the LINQ to SQL designer was required in order to leverage LINQ to SQL in their applications.&amp;#160; They had existing data entity classes that they wanted to use and didn’t want to re-create them using the designer.&amp;#160; In situations like this you can use built-in XML mapping features available in LINQ to SQL to get around using the designer if desired.&amp;#160; Going this route leads to writing more custom code and XML mapping files but also provides the ultimate in control especially if your data entity classes are created by another tool, you don’t want your classes littered with LINQ to SQL attributes, or you have some other reason for not wanting to use the designer.&amp;#160; In this article I’ll provide a step by step introduction to working with LINQ to SQL XML mapping files.&lt;/p&gt;  &lt;h2&gt;   &lt;br /&gt;Step 1. Create the Data Entity Class&lt;/h2&gt;  &lt;p&gt;If you’re not using the LINQ to SQL designer then you’ll need to create your own data entity classes (or use a 3rd party tool to create them) that can hold data from the target database.&amp;#160; If you already have existing data entity classes that you want to use then you can skip this step.&amp;#160; Here’s a simple Customer class capable of holding some of the data found in the Customer table in the &lt;a href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004" target="_blank"&gt;AdventureWorksLT&lt;/a&gt; database.&amp;#160; A diagram of the Customer table follows.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;font color="#000000"&gt;Model&lt;/font&gt;&lt;/span&gt;
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Customer
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public int &lt;/span&gt;CustomerID { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Title { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;FirstName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;LastName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime &lt;/span&gt;ModifiedDate { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h2&gt;
  &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/UsingLINQtoSQLXMLMappingFiles_13EC6/image_4.png"&gt;&lt;img title="image" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="320" alt="image" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/UsingLINQtoSQLXMLMappingFiles_13EC6/image_thumb_1.png" width="291" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;2. Create the XML Mapping File&lt;/h2&gt;

&lt;p&gt;Visual Studio 2008 provides a LINQ to SQL intellisense schema located at Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\LinqToSqlMapping.xsd.&amp;#160; The schema contains a namespace of http://schemas.microsoft.com/linqtosql/mapping/2007 in it that can be used in your custom LINQ to SQL XML mapping files to get intellisense as you create your XML mappings.&amp;#160; Start by creating an XML file in your Visual Studio 2008 project.&amp;#160; Once the file is created add a Database element that defines the http://schemas.microsoft.com/linqtosql/mapping/2007&amp;#160; namespace on it (see the XML code below for an example).&amp;#160; Doing this will give you intellisense for the XML mapping file as you type in additional tags.&amp;#160; Within the Database element add one or more Table elements.&amp;#160; Each Table element will contain child Column elements that define how the individual table columns map to class properties.&amp;#160; In addition to defining table mappings, stored procedures can also be defined using a Function tag.&amp;#160; &lt;/p&gt;

&lt;p&gt;Here’s an example of mapping the Customer class shown earlier to the Customer table in AdventureWorksLT.&amp;#160; Notice that the intellisense xsd schema namespace mentioned earlier is defined on the root element in the mapping file. While the namespace isn’t required, having intellisense definitely speeds up the process of creating the mapping file.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1.0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;encoding&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;utf-8&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Database &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AdventureWorksLT&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;http://schemas.microsoft.com/linqtosql/mapping/2007&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Table &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;SalesLT.Customer&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Member&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Model.Customer&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Type &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Model.Customer&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Column &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;CustomerID&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Member&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;CustomerID&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;IsDbGenerated&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;IsPrimaryKey&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Column &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Title&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Member&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Title&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Column &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;FirstName&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Member&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;FirstName&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Column &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;LastName&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Member&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;LastName&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Column &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ModifiedDate&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Member&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ModifiedDate&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Type&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Table&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Function &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;dbo.ap_GetCustomerByLastName&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Method&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;GetCustomerByLastName&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Parameter &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;lastNameLetter&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;Parameter&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;LastNameLetter&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ElementType &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Model.Customer&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Function&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Database&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Looking through the file you’ll see that the Model.Customer class is mapped to the SalesLT.Customer table and that each field is mapped as appropriate.&amp;#160; The primary key in the table is defined using the IsPrimaryKey attribute along with the IsDbGenerated attribute.&amp;#160; The XML mapping file also includes a reference to a stored procedure named ap_GetCustomerByLastName which looks like the following:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;CREATE PROCEDURE &lt;/span&gt;dbo.ap_GetCustomerByLastName
    (
        @LastNameLetter &lt;span style="color: blue"&gt;char&lt;/span&gt;(1)
    )
&lt;span style="color: blue"&gt;AS
    BEGIN
        SELECT &lt;/span&gt;CustomerID, Title, FirstName, LastName, ModifiedDate 
        &lt;span style="color: blue"&gt;FROM &lt;/span&gt;SalesLT.Customer
        &lt;span style="color: blue"&gt;WHERE &lt;/span&gt;LastName &lt;span style="color: blue"&gt;LIKE &lt;/span&gt;@LastNameLetter + &lt;span style="color: #a31515"&gt;'%'
    &lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;
  &lt;br /&gt;The mapping file maps the stored procedure to a custom method named GetCustomerByLastName which accepts a single parameter named lastNameLetter.&amp;#160; Data returned from the stored procedure call is automatically mapped to the Model.Customer class using the mapping file’s ElementType element.&amp;#160; &lt;/p&gt;

&lt;p&gt;Note:&amp;#160; The SqlMetal.exe command-line tool can be used to automatically generate the XML mappings for a database quickly and easily (it can generate code as well if desired).&amp;#160; Although it won’t handle mapping the database fields to your custom data entity classes, it can be used to generate initial XML mapping code that can be modified quickly.&amp;#160; To generate the mapping file you can run the following command using the Visual Studio 2008 command prompt.&amp;#160; This command generates an XML mapping file for the entire AdventureWorksLT database and includes functions and stored procedures in the output.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;sqlmetal.exe&amp;#160; /server:YourDBServer&amp;#160; /database:AdventureWorksLT&amp;#160; /dbml:AdventureWorksLT.dbml&amp;#160; /functions&amp;#160; /sprocs&amp;#160; /namespace:Data&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  &lt;br /&gt;3. Create a Custom DataContext Class&lt;/h2&gt;

&lt;p&gt;If you’ll be querying the database directly using LINQ or Lambda expressions you can use the built-in System.Data.Linq.DataContext class directly to run your queries and skip this step.&amp;#160; However, if you also need to query a stored procedure defined in a mapping file then you’ll want to create a custom class that derives from the DataContext class.&amp;#160; This is necessary since you’ll need to access the protected ExecuteMethodCall() method found in DataContext which can be used to call stored procedures.&amp;#160; Here’s the signature for the ExecuteMethodCall() method:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;//
// Summary:
//     Executes the stored database procedure or scalar function associated with
//     the specified CLR method.
//
// Parameters:
//   instance:
//&amp;#160; The instance of the method invocation (the current object).
//
//   methodInfo:
//     Identifies the CLR method that corresponds to a database method.
//
//   parameters:
//     The array of parameters to be passed to the command.
//
// Returns:
//     The result (the return value and output parameters) of executing the specified
//     method.
&lt;/span&gt;&lt;span style="color: blue"&gt;protected internal &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IExecuteResult &lt;/span&gt;ExecuteMethodCall(&lt;span style="color: blue"&gt;object &lt;/span&gt;instance, &lt;span style="color: #2b91af"&gt;MethodInfo &lt;/span&gt;methodInfo, &lt;span style="color: blue"&gt;params object&lt;/span&gt;[] parameters);&lt;br /&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Creating a custom DataContext class is a bit of extra work, but I normally create a custom class that inherits from DataContext or my LINQ to SQL designer class if I’m using the Visual Studio 2008 designer anyway so that I can control things like logging and connection strings in a more centralized place.&amp;#160; Here’s a simple example of a custom class named CustomDataContext that derives from DataContext and exposes a GetCustomerByLastName() method that is used to call the ap_GetCustomerByLastName stored procedure shown previously.&amp;#160; Notice that the method calls the DataContext class’s ExecuteMethodCall() method and passes in the name of the method to call (contained within the System.Reflection.MethodInfo object) as well as the parameter data to pass to the stored procedure.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.Linq.Mapping;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Reflection;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;ConsoleApplication1
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomDataContext &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;DataContext
    &lt;/span&gt;{

        &lt;span style="color: blue"&gt;public &lt;/span&gt;CustomDataContext(&lt;span style="color: blue"&gt;string &lt;/span&gt;connStr, &lt;span style="color: #2b91af"&gt;XmlMappingSource &lt;/span&gt;xmlMap) : &lt;span style="color: blue"&gt;base&lt;/span&gt;(connStr, xmlMap) { }

        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;DAL.&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt; GetCustomerByLastName(&lt;span style="color: blue"&gt;string &lt;/span&gt;lastNameLetter)
        {
            &lt;span style="color: #2b91af"&gt;IExecuteResult &lt;/span&gt;result = &lt;span style="color: blue"&gt;this&lt;/span&gt;.ExecuteMethodCall(&lt;span style="color: blue"&gt;this&lt;/span&gt;, ((&lt;span style="color: #2b91af"&gt;MethodInfo&lt;/span&gt;)(&lt;span style="color: #2b91af"&gt;MethodInfo&lt;/span&gt;.GetCurrentMethod())), lastNameLetter);
            &lt;span style="color: blue"&gt;return &lt;/span&gt;result.ReturnValue &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;DAL.&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt;;
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h2&gt;
  &lt;br /&gt;Step 4. Load the XML Mapping File into the DataContext Object&lt;/h2&gt;

&lt;p&gt;Once the data entity class, XML mapping file and custom DataContext class have been created you can use the DataContext class to query the database and automatically map the appropriate database fields to their corresponding Model.Customer properties.&amp;#160; When using the LINQ to SQL designer you can simply create a new instance of the DataContext class and be on your way since the designer generates code that includes C# or VB.NET mapping attributes.&amp;#160; When using XML mapping files you’ll need to load the mapping file into the DataContext object so that it knows the proper mappings to use.&amp;#160; Here’s an example of creating a CustomDataContext object instance and loading the XML mapping file.&amp;#160; Notice that the mapping file is loaded by using System.Data.Linq.Mapping.XmlMappingSource class’s FromUrl() method.&amp;#160; XML mapping files can also be loaded from a string, stream or XmlReader.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.Linq.Mapping;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Text;

&lt;span style="color: blue"&gt;namespace &lt;font color="#000000"&gt;LINQAndXMLMapping&lt;/font&gt;&lt;/span&gt;
{
    &lt;span style="color: blue"&gt;class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Program
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;static void &lt;/span&gt;Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)
        {  
            &lt;span style="color: blue"&gt;string &lt;/span&gt;connStr = &lt;span style="color: #a31515"&gt;&amp;quot;server=.;database=AdventureWorksLT;integrated security=true;&amp;quot;&lt;/span&gt;;
            &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;CustomDataContext &lt;/span&gt;context = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomDataContext&lt;/span&gt;(connStr, &lt;span style="color: #2b91af"&gt;XmlMappingSource&lt;/span&gt;.FromUrl(&lt;span style="color: #a31515"&gt;&amp;quot;CustomerMapping.xml&amp;quot;&lt;/span&gt;)))
            {&lt;br /&gt;                //Perform query
&lt;br /&gt;&lt;br /&gt;            }
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Read();
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h2&gt;
  &lt;br /&gt;Step 5. Query the Database Using the DataContext Object&lt;/h2&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Once the XML mapping file is loaded into the DataContext object you can query the database using LINQ or Lambda expressions.&amp;#160; Here’s an example of grabbing all of the customer records that have a last name starting with “M”:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;DAL.&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt; custs = &lt;span style="color: blue"&gt;from &lt;/span&gt;c &lt;span style="color: blue"&gt;in &lt;/span&gt;context.GetTable&amp;lt;DAL.&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt;()
                                  &lt;span style="color: blue"&gt;where &lt;/span&gt;c.LastName.StartsWith(&lt;span style="color: #a31515"&gt;&amp;quot;M&amp;quot;&lt;/span&gt;)
                                  &lt;span style="color: blue"&gt;select &lt;/span&gt;c;
&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(DAL.&lt;span style="color: #2b91af"&gt;Customer &lt;/span&gt;cust &lt;span style="color: blue"&gt;in &lt;/span&gt;custs)
{
     &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(cust.FirstName + &lt;span style="color: #a31515"&gt;&amp;quot; &amp;quot; &lt;/span&gt;+ cust.LastName);
}&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;The ap_GetCustomerByLastName stored procedure can be called using the CustomDataContext object’s GetCustomerByLastName() method as shown next: 

  &lt;br /&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;DAL.&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt; custs2 = context.GetCustomerByLastName(&lt;span style="color: #a31515"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;);
&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(DAL.&lt;span style="color: #2b91af"&gt;Customer &lt;/span&gt;cust &lt;span style="color: blue"&gt;in &lt;/span&gt;custs2)
{
    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(cust.FirstName + &lt;span style="color: #a31515"&gt;&amp;quot; &amp;quot; &lt;/span&gt;+ cust.LastName);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;br /&gt;

&lt;p&gt;The results of the two queries are shown next:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/UsingLINQtoSQLXMLMappingFiles_13EC6/image_2.png"&gt;&lt;img title="image" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="323" alt="image" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/UsingLINQtoSQLXMLMappingFiles_13EC6/image_thumb.png" width="598" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Although the LINQ to SQL designer provides the biggest bang for the buck as far as productivity goes when working with LINQ to SQL, the XML mapping features discussed here (although not as productive from a time standpoint) allow you to have more control over the classes that are used in an application and the manner in which they’re mapped to database tables.&amp;#160; Regardless of which route you choose to go, LINQ to SQL will definitely provide a productivity boost for many applications especially when compared to writing data access code from scratch.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Downloads&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://www.xmlforasp.net/CodeBank/Download/Blog/LINQAndXMLMapping.zip"&gt;Download the sample code here&lt;/a&gt;.&amp;#160; &lt;/li&gt;

  &lt;li&gt;Download the AdventureWorksLT database used in the application &lt;a href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004" target="_blank"&gt;here&lt;/a&gt; (look for AdventureWorksLT.msi) &lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6534133" width="1" height="1"&gt;</description></item><item><title>Introduction to Layout Controls in Silverlight 2</title><link>http://weblogs.asp.net/dwahlin/archive/2008/08/12/introduction-to-layout-controls-in-silverlight-2.aspx</link><pubDate>Tue, 12 Aug 2008 22:25:15 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6510079</guid><dc:creator>dwahlin</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6510079</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/08/12/introduction-to-layout-controls-in-silverlight-2.aspx#comments</comments><description>&lt;p&gt;Arranging controls on a user interface in a flexible manner is key to building successful applications.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Silverlight 2 provides three main controls that can be used for layout management:&lt;/p&gt;  &lt;p class="BLlast" style="margin-left: 60pt; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Canvas Control&lt;/p&gt;  &lt;p class="BLlast" style="margin-left: 60pt; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;StackPanel Control&lt;/p&gt;  &lt;p class="BLlast" style="margin-left: 60pt; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Grid Control&lt;/p&gt;  &lt;p class="GX"&gt;In this post I'll provide an introductory look at these controls and show how they can be defined in XAML.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Future articles will use the layout controls to arrange controls that are capable of displaying data retrieved from remote sources.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Let's start out by examining the Canvas control.&lt;/p&gt;  &lt;h2&gt;The Canvas Control&lt;/h2&gt;  &lt;p class="GX"&gt;HTML developers use various types of container tags to group related content in a Web page.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;div&lt;/span&gt;&lt;/span&gt; element is especially popular now days since it can be combined with CSS to provide a flexible layout for Web pages without requiring tables.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Although Silverlight 2 doesn't support the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;div&lt;/span&gt;&lt;/span&gt; element, it does provide a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; element that can be used to group related content.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; element acts like the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;div&lt;/span&gt;&lt;/span&gt; element in many regards and can have children nested inside of it.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;It's typically used when children need to be positioned at exact x and y coordinates.&lt;/p&gt;  &lt;p class="GX"&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; object derives from a base class called &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Panel&lt;/span&gt;&lt;/span&gt; and exposes several properties such as &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Name&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Background&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Cursor&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Height&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Width&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;HorizontalAlignment&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;VerticalAlignment&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Opacity&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;OpacityMask&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;RenderTransform&lt;/span&gt;&lt;/span&gt; and &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Visibility &lt;/span&gt;&lt;/span&gt;(to name a few).&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Children can be positioned within a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; by using attached properties such as &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.Left&lt;/span&gt;&lt;/span&gt;, &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.Top&lt;/span&gt;&lt;/span&gt; and &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.ZIndex&lt;/span&gt;&lt;/span&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;An example of using a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; to arrange two &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;TextBlock&lt;/span&gt;&lt;/span&gt; controls and a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Rectangle&lt;/span&gt;&lt;/span&gt; is shown next:&lt;/p&gt;  &lt;p class="codewscreen"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;&lt;/span&gt;    &lt;p&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ShapesCanvas&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Top&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;600&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LightGray&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot;&amp;gt;
    
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;40&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Navy&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Canvas Text&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Rectangle &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Fill&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Yellow&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.ZIndex&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-1&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;150&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;300&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;30&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Green&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;More Text...&amp;quot; /&amp;gt;

&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
  &lt;br /&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; object shown here is positioned to the top left of its parent container, is 200 X 600 pixels in size, has a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;LightGray&lt;/span&gt;&lt;/span&gt; background and a margin of 20 pixels applied uniformly to its left, top, right and bottom margins.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The children within the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; are positioned using the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.Top&lt;/span&gt;&lt;/span&gt; and &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.Left&lt;/span&gt;&lt;/span&gt; attached properties.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Because &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Rectangle&lt;/span&gt;&lt;/span&gt; is defined after the first TextBlock it would normally be positioned above the text.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;By using the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.ZIndex&lt;/span&gt;&lt;/span&gt; attached property, however, you can change how items are arranged and place objects above or below other items quite easily.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;By moving the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Rectangle&lt;/span&gt;&lt;/span&gt; before the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;TextBlock&lt;/span&gt;&lt;/span&gt; in the XAML code the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas.ZIndex&lt;/span&gt;&lt;/span&gt; property could be removed though.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;/p&gt;

&lt;p class="GX"&gt;Figure 1 shows how the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; and its child objects render at runtime in a Silverlight application.&lt;/p&gt;

&lt;p class="GX"&gt;&lt;span style="font-size: 20pt; color: red; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-bidi-font-size: 10.0pt; mso-no-proof: yes; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa"&gt;&lt;shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;stroke joinstyle="miter"&gt;&lt;/stroke&gt;&lt;formulas&gt;&lt;f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/f&gt;&lt;f eqn="sum @0 1 0"&gt;&lt;/f&gt;&lt;f eqn="sum 0 0 @1"&gt;&lt;/f&gt;&lt;f eqn="prod @2 1 2"&gt;&lt;/f&gt;&lt;f eqn="prod @3 21600 pixelWidth"&gt;&lt;/f&gt;&lt;f eqn="prod @3 21600 pixelHeight"&gt;&lt;/f&gt;&lt;f eqn="sum @0 0 1"&gt;&lt;/f&gt;&lt;f eqn="prod @6 1 2"&gt;&lt;/f&gt;&lt;f eqn="prod @7 21600 pixelWidth"&gt;&lt;/f&gt;&lt;f eqn="sum @8 21600 0"&gt;&lt;/f&gt;&lt;f eqn="prod @7 21600 pixelHeight"&gt;&lt;/f&gt;&lt;f eqn="sum @10 21600 0"&gt;&lt;/f&gt;&lt;/formulas&gt;&lt;path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/path&gt;&lt;lock aspectratio="t" v:ext="edit"&gt;&lt;/lock&gt;&lt;/shapetype&gt;&lt;shape id="Picture_x0020_12" style="visibility: visible; width: 6in; height: 152.25pt" alt="277751 fg06015.bmp" type="#_x0000_t75" o:spid="_x0000_i1025"&gt;&lt;imagedata o:title="277751 fg06015" src="file:///C:\Users\wahlind\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure1_2.jpg"&gt;&lt;img title="Figure1" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="207" alt="Figure1" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure1_thumb.jpg" width="578" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p class="F"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;stroke joinstyle="miter"&gt;&lt;/stroke&gt;&lt;formulas&gt;&lt;f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/f&gt;&lt;f eqn="sum @0 1 0"&gt;&lt;/f&gt;&lt;f eqn="sum 0 0 @1"&gt;&lt;/f&gt;&lt;f eqn="prod @2 1 2"&gt;&lt;/f&gt;&lt;f eqn="prod @3 21600 pixelWidth"&gt;&lt;/f&gt;&lt;f eqn="prod @3 21600 pixelHeight"&gt;&lt;/f&gt;&lt;f eqn="sum @0 0 1"&gt;&lt;/f&gt;&lt;f eqn="prod @6 1 2"&gt;&lt;/f&gt;&lt;f eqn="prod @7 21600 pixelWidth"&gt;&lt;/f&gt;&lt;f eqn="sum @8 21600 0"&gt;&lt;/f&gt;&lt;f eqn="prod @7 21600 pixelHeight"&gt;&lt;/f&gt;&lt;f eqn="sum @10 21600 0"&gt;&lt;/f&gt;&lt;/formulas&gt;&lt;path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/path&gt;&lt;lock aspectratio="t" v:ext="edit"&gt;&lt;/lock&gt;&lt;/shapetype&gt;&lt;shape id="Picture_x0020_12" style="visibility: visible; width: 6in; height: 152.25pt" alt="277751 fg06015.bmp" type="#_x0000_t75" o:spid="_x0000_i1025"&gt;&lt;imagedata o:title="277751 fg06015" src="file:///C:\Users\wahlind\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;&lt;strong&gt;Figure 1 &lt;/strong&gt;

    &lt;p&gt;&lt;/p&gt;
  &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p class="GX"&gt;Multiple &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; objects can be defined in a XAML file just like multiple &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;div&lt;/span&gt;&lt;/span&gt; tags can be placed in a HTML file.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The XAML code that follows shows how multiple &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; objects can be used as place holders for controls that are created during runtime: &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;AlbumViewer2.Page&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/client/2007&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;800&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;650&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MainCanvas&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ImageBrush &lt;/span&gt;&lt;span style="color: red"&gt;ImageSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Images/NavyBg.jpg&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Fill&amp;quot; /&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas.Background&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!-- Search controls go here --&amp;gt;

        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LoadingCanvas&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;225&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;150&amp;quot; 
         &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red&amp;quot;&amp;gt;

            &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!-- Loading data info objects go here --&amp;gt;

        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;AlbumsCanvas&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;50&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Collapsed&amp;quot;&amp;gt;

            &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!-- Albums go here --&amp;gt;
            
        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;NavCanvas&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;425&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;300&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;300&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Collapsed&amp;quot;&amp;gt;

            &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!-- Navigation controls go here --&amp;gt;

        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;AlbumDetailsCanvas&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;495&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;15&amp;quot; 
          &lt;/span&gt;&lt;span style="color: red"&gt;Visibility&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Collapsed&amp;quot;&amp;gt;

            &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!-- Album details controls go here --&amp;gt;

        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Canvas&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;UserControl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p class="GX"&gt;Figure 2 shows how the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; objects and associated child objects are rendered at runtime. 

  &lt;br /&gt;

  &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure2_2.jpg"&gt;&lt;img title="Figure2" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="487" alt="Figure2" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure2_thumb.jpg" width="567" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p class="F"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;shape id="Picture_x0020_22" style="visibility: visible; width: 6in; height: 371.25pt" alt="277751 fg06016.bmp" type="#_x0000_t75" o:spid="_x0000_i1026"&gt;&lt;imagedata o:title="277751 fg06016" src="file:///C:\Users\wahlind\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;&lt;strong&gt;Figure 2 &lt;/strong&gt;

    &lt;p&gt;&lt;/p&gt;
  &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  &lt;br /&gt;The StackPanel Control&lt;/h2&gt;

&lt;p class="GX"&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Canvas&lt;/span&gt;&lt;/span&gt; control can be used when child objects need to be absolutely positioned.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;While absolute positioning may be useful in some Silverlight 2 applications, others can benefit from having controls that are dynamically laid out based upon the size of the Silverlight interface.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;By using dynamic control layout you allow users to switch to full-screen mode without writing a lot of code to adjust control coordinates.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Silverlight 2 provides the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; control that can be used to stack objects horizontally or vertically and provide more flexible layouts.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;By using the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; you can arrange controls on an interface without defining absolute positions for each control.&lt;/p&gt;

&lt;p class="GX"&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; control acts much like the ASP.NET &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;DataList&lt;/span&gt;&lt;/span&gt; control.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Data can be displayed horizontally or vertically by assigning a value to the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;DataList&lt;/span&gt;&lt;/span&gt; control's &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;RepeatDirection&lt;/span&gt;&lt;/span&gt; property.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;RepeatDirection&lt;/span&gt;&lt;/span&gt; accepts one of two enumeration values including &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Horizontal&lt;/span&gt;&lt;/span&gt; and &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Vertical&lt;/span&gt;&lt;/span&gt;.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; control provides an &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Orientation&lt;/span&gt;&lt;/span&gt; property that is used to determine how to layout controls on an interface (the default layout is vertical).&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Like the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;DataList&lt;/span&gt;&lt;/span&gt; control's &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;RepeatDirection&lt;/span&gt;&lt;/span&gt; property, the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Orientation&lt;/span&gt;&lt;/span&gt; property also accepts &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Horizontal&lt;/span&gt;&lt;/span&gt; and &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Vertical&lt;/span&gt;&lt;/span&gt; values&lt;/p&gt;

&lt;p class="GX"&gt;Although&lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt; StackPanel&lt;/span&gt;&lt;/span&gt; and &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;DataList&lt;/span&gt;&lt;/span&gt; are similar in some ways, they differ in the way data is wrapped when child controls exceed the size of the parent container.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;DataList&lt;/span&gt;&lt;/span&gt; control provides a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;RepeatColumns&lt;/span&gt;&lt;/span&gt; property that determines how many columns are displayed before creating a new row.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; doesn't provide that functionality unfortunately.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;As a result, child controls that exceed the bounds of the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; will not display properly on the user interface.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;/p&gt;

&lt;p class="Boxtext"&gt;WPF provides a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;WrapPanel&lt;/span&gt;&lt;/span&gt; control that handles wrapping child controls when they exceed the size of the parent container.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Silverlight doesn't provide a built-in &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;WrapPanel&lt;/span&gt;&lt;/span&gt; control, however, several &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;WrapPanel&lt;/span&gt;&lt;/span&gt; controls have been created by members of the Silverlight community that can be found using your favorite search engine.&lt;/p&gt;

&lt;p class="GX"&gt;The code that follows shows how to arrange two &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;TextBlock&lt;/span&gt;&lt;/span&gt; controls horizontally by setting the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; control's &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Orientation&lt;/span&gt;&lt;/span&gt; property to &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Horizontal&lt;/span&gt;&lt;/span&gt;. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LightGray&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal StackPanel - First Control&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Navy&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Horizontal StackPanel - Second Control&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;

&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p class="codewscreen"&gt;
  &lt;br /&gt;Controls can also be arranged vertically by changing the &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Orientation&lt;/span&gt;&lt;/span&gt; property to a value of &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Vertical&lt;/span&gt;&lt;/span&gt;:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Vertical&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LightGray&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Vertical StackPanel - First Control&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Navy&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Vertical StackPanel - Second Control&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;20&amp;quot; 
        &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Red&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;10&amp;quot; /&amp;gt;

&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p class="codewscreen"&gt;
  &lt;br /&gt;Figure 3 shows the result of the horizontal orientation while Figure 4 shows the result of the vertical orientation. Both figures demonstrate how a &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;StackPanel&lt;/span&gt;&lt;/span&gt; control automatically fills the width of its parent container.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;This default behavior can be changed by assigning a value to the control's &lt;span class="CodeinText"&gt;&lt;span style="font-size: 9.5pt; mso-bidi-font-size: 10.0pt"&gt;Width&lt;/span&gt;&lt;/span&gt; property.&lt;/p&gt;

&lt;p class="GX"&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure3_2.jpg"&gt;&lt;img title="Figure3" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="53" alt="Figure3" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure3_thumb.jpg" width="692" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p class="F"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;shape id="Picture_x0020_19" style="visibility: visible; width: 6in; height: 31.5pt" alt="277751 fg06017.bmp" type="#_x0000_t75" o:spid="_x0000_i1027"&gt;&lt;imagedata o:title="277751 fg06017" src="file:///C:\Users\wahlind\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;&lt;strong&gt;&lt;/strong&gt;

    &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure4_2.jpg"&gt;&lt;img title="Figure4" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="97" alt="Figure4" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure4_thumb.jpg" width="698" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
  &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p class="F"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;shape id="Picture_x0020_23" style="visibility: visible; width: 6in; height: 57.75pt" alt="277751 fg06018.bmp" type="#_x0000_t75" o:spid="_x0000_i1028"&gt;&lt;imagedata o:title="277751 fg06018" src="file:///C:\Users\wahlind\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;&lt;strong&gt;Figure 4&lt;/strong&gt; 

    &lt;br /&gt;

    &lt;br /&gt;

    &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 15pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-bidi-font-size: 10.0pt; mso-bidi-font-weight: bold; mso-bidi-font-style: italic"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;The Grid Control&lt;/h2&gt;

&lt;p class="FC"&gt;&lt;span style="font-weight: normal; font-size: 10pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;Web designers have been accustomed to arranging data and controls in tables for years.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Although there's been a general shift to CSS and div tags for page layout, table tags are still quite popular.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;If you're coming from a Web development background you'll find Silverlight's Grid control easy to use and quick to comprehend since it's similar to what you've already been using.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;It acts much like HTML's table tag and allows data and controls to be arranged in a tabular-style view. 

    &lt;br /&gt;

    &lt;br /&gt;The Grid control allows rows and columns to be defined much more concisely compared to HTML.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;With the HTML table tag you're forced to repeat multiple tr and td tags to create rows and columns.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The Grid control allows rows and column information to be defined in one location using RowDefinition and ColumnDefinition tags.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;An example of XAML code that creates a simple Grid with 2 rows and 2 columns is shown next: &lt;/span&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;myTable&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ShowGridLines&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;|
    
    &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;.25*&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;.75*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p class="FC"&gt;&lt;span style="font-weight: normal; font-size: 10pt; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;"&gt;This example sets the Grid's ShowGridLines attribute to True which is nice for seeing the initial layout of a Grid control.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;Figure 5 shows how the Grid looks in Visual Studio 2008 when ShowGridLines is set to True. &lt;/span&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p class="F"&gt;&lt;shape id="_x0000_i1029" style="width: 337.5pt; height: 146.25pt" type="#_x0000_t75"&gt;&lt;imagedata o:title="Figure1" src="file:///C:\Users\wahlind\AppData\Local\Temp\msohtmlclip1\01\clip_image005.jpg"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;strong&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure5_2.jpg"&gt;&lt;img title="Figure5" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="216" alt="Figure5" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure5_thumb.jpg" width="494" border="0" /&gt;&lt;/a&gt; &lt;/strong&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;strong&gt;Figure 5&lt;/strong&gt;&lt;/p&gt;

&lt;p class="GX"&gt;The XAML code also sets the first row's height to 100 pixels and the second row's height to the remaining space available in the user interface When you use the * character to define a row height you're essentially telling the Grid to assign the row 100% of the remaining space. &lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;You could also omit the Height attribute entirely in this case and achieve the same affect.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;In addition to the row definitions, the two columns defined have widths of 25% and 75% respectively.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;/b&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p class="GX"&gt;It's important to note that the ColumnDefinition tag's Width attribute and RowDefinition tag's Height attribute do not accept the typical values assigned to HTML tr and td tags.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;For example, assigning the Width attribute a value of 25% will result in an error.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;If you've spent a lot of time creating Web pages you may struggle with this initially (I know I did!) since using the % character is so common in HTML and CSS.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;In Silverlight, percentage based widths are assigned by defining a decimal value between 0 and 1 followed by the * character.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;However, you can also assign whole numbers such as 1* and 9* for 10% and 90% respectively.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;In addition to numeric values, the Height and Width attributes also accept a value of Auto which causes the appropriate row or column to automatically figure out its size based on available space.&lt;/p&gt;

&lt;p class="GX"&gt;Once rows and columns are defined, controls can be placed inside of a Grid using Grid.Row and Grid.Column attributes.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The following XAML shows how 4 TextBlock controls can be defined and assigned to different rows and columns of a Grid:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;myTable&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;White&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ShowGridLines&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;.25*&amp;quot; /&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;.75*&amp;quot; /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot; /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;  /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;  /&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1,1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;  /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p class="GX"&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p class="GX"&gt;Figure 6 shows what the Grid control and associated child controls look like at runtime:&lt;/p&gt;

&lt;p class="F"&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure6_2.jpg"&gt;&lt;img title="Figure6" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="237" alt="Figure6" src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/IntroductiontoLayoutControlsinSilverligh_D46F/Figure6_thumb.jpg" width="494" border="0" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p class="FC"&gt;&lt;strong&gt;Figure 6&lt;/strong&gt;&lt;/p&gt;

&lt;p class="GX"&gt;In situations where you need a control to span multiple rows or columns you can use the Grid.RowSpan or Grid.ColumnSpan attributes.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;For example, the following button would be placed in the first row and span two columns:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;Content&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Button&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p class="GX"&gt;
  &lt;br /&gt;In summary, Silverlight 2 offers several different controls that can be used to layout data and child controls on a user interface.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;The Canvas control allows for exact positioning whereas the StackPanel control provides more flexible control layout. &lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;The Grid control provides a simple way to arrange controls in a tabular-style on a user interface.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;In cases where you need additional layout flexibility such as arranging controls vertically or horizontally within a Grid cell, you can also combine layout controls such as the StackPanel (covered in a previous article) or Canvas with a Grid.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;/b&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6510079" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Syncing a Windows Mobile Device Emulator with Vista’s Mobile Device Center</title><link>http://weblogs.asp.net/dwahlin/archive/2008/08/03/syncing-a-windows-mobile-device-emulator-with-vista-s-mobile-device-center.aspx</link><pubDate>Sun, 03 Aug 2008 22:46:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6477973</guid><dc:creator>dwahlin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6477973</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/08/03/syncing-a-windows-mobile-device-emulator-with-vista-s-mobile-device-center.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;I started working on a Windows Mobile application on Vista and couldn’t get the emulator to sync property with the Mobile Device Center.&amp;nbsp; I’d synced device emulators long ago on XP with ActiveSync but just couldn’t get it working like I wanted on Vista.&amp;nbsp; I had the different 6.0 and 6.1 SDKs installed, had the Cellular Emulator working perfectly with the device emulator but couldn’t sync to save my life.&amp;nbsp; I needed to move over a C++ dll that needed to live in the device emulator’s Windows directory.&amp;nbsp; After a lot of searching it turns out that all I had to do was enable DMA in the connection settings for the Mobile Device Center as shown next:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SyncingaWindowsMobileEmulatorwithVistasM_DD85/image_2.png" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SyncingaWindowsMobileEmulatorwithVistasM_DD85/image_2.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=273 alt=image src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SyncingaWindowsMobileEmulatorwithVistasM_DD85/image_thumb.png" width=437 border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SyncingaWindowsMobileEmulatorwithVistasM_DD85/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get to this dialog by going to Windows Mobile Device Center | Mobile Device Settings | Connection Settings.&amp;nbsp; Once I had the DMA connection setup properly the Mobile Device Center was able to locate the emulator and allow me to get to the file system.&amp;nbsp; Simple…once you know the trick. :-) &lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6477973" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Mobile/default.aspx">Mobile</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Phone/default.aspx">Phone</category></item><item><title>ASP.NET - Render Hidden Fields at the Top of a Form with .NET 3.5 SP1</title><link>http://weblogs.asp.net/dwahlin/archive/2008/07/22/asp-net-render-hidden-fields-at-the-top-of-a-form-with-net-3-5-sp1.aspx</link><pubDate>Tue, 22 Jul 2008 21:35:54 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6433278</guid><dc:creator>dwahlin</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6433278</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/07/22/asp-net-render-hidden-fields-at-the-top-of-a-form-with-net-3-5-sp1.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;I just came across a nice feature in ASP.NET 3.5 SP1 (currently in &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=8C36ACA4-E947-4760-9B05-93CAC04C6F87&amp;amp;displaylang=en" target="_blank"&gt;Beta&lt;/a&gt;) that I didn’t realize was included.&amp;#160; It’s always nice to discover hidden gems from time to time.&amp;#160; With ASP.NET 1.0, 1.1, 2.0 and 3.5 applications if a user or JavaScript function tried to do a postback before all of the ViewState and EventValidation data was loaded in the browser, a ViewState MAC validation error could be raised by the server.&lt;/p&gt;  &lt;p&gt;In ASP.NET 3.5 SP1 Microsoft provides a new attribute on the &amp;lt;pages&amp;gt; element in web.config that now allows all hidden fields to be rendered at the top of a form rather than at the bottom which can help to avoid the ViewState MAC validation error when people perform a postback operation before the page has finished loading.&amp;#160; The attribute is named &lt;strong&gt;renderAllHiddenFieldsAtTopOfForm&lt;/strong&gt; (which does what it says) and defaults to a value of true.&amp;#160; .NET 3.5 SP1 is currently in beta but once it’s officially released the new attribute is definitely a nice enhancement to the ASP.NET framework.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Need to display OrgCharts, site maps or other hierarchies in your ASP.NET applications?&amp;#160; Check out &lt;a href="http://www.smartwebcontrols.com/"&gt;SmartChartPro&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.smartwebcontrols.com/"&gt;&lt;img src="http://www.smartwebcontrols.com/images/smartchartprologo.gif" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6433278" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Instinct Experiment Over…Back to Windows Mobile</title><link>http://weblogs.asp.net/dwahlin/archive/2008/07/16/instinct-experiment-over-back-to-windows-mobile.aspx</link><pubDate>Wed, 16 Jul 2008 16:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6407197</guid><dc:creator>dwahlin</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6407197</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/07/16/instinct-experiment-over-back-to-windows-mobile.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;Over the past few weeks I’ve been trying out the &lt;A href="http://www.instinctthephone.com/?id12=UHP_Masthead_063008_instinctthephone" target=_blank mce_href="http://www.instinctthephone.com/?id12=UHP_Masthead_063008_instinctthephone"&gt;Sprint Instinct&lt;/A&gt; touch screen phone to see how I liked it.&amp;nbsp; I wrote my initial review &lt;A href="http://weblogs.asp.net/dwahlin/archive/2008/06/26/pros-and-cons-of-the-sprint-instinct-phone.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2008/06/26/pros-and-cons-of-the-sprint-instinct-phone.aspx"&gt;here&lt;/A&gt; and posted some tips and tricks on using the device &lt;A href="http://weblogs.asp.net/dwahlin/archive/2008/07/10/sprint-instinct-tips-and-tricks.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2008/07/10/sprint-instinct-tips-and-tricks.aspx"&gt;here&lt;/A&gt;.&amp;nbsp; The poor browsing experience on the Instinct finally led me to take it back to the store yesterday so I’m back to using my PPC-6700 until Sprint releases the &lt;A href="http://www.htc.com/www/product.aspx?id=46278" target=_blank mce_href="http://www.htc.com/www/product.aspx?id=46278"&gt;HTC Touch Diamond&lt;/A&gt; (or Pro) later this year.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Although I’ll admit that I have to reboot my Windows mobile phone every other day or so, it was really hard giving up all of the flexibility.&amp;nbsp; The Instinct had a great touch screen, many excellent features (especially the GPS capabilities and visual voice mail), but the lack of EVDO Rev A speed (even though it’s supposedly built-in…although I never got it) and poor browser just weren’t worth it.&amp;nbsp; My browsing experience is much faster on my EVDO enabled PPC-6700 even though it’s 2 years old.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Last night I installed a Midlet Manager on my PPC-6700 and have Opera 4.1 mini going and it’s amazing how much faster it is than what I was getting on the Instinct.&amp;nbsp; I also installed the latest version of &lt;A href="http://spbsoftwarehouse.com/?en" target=_blank mce_href="http://spbsoftwarehouse.com/?en"&gt;SPB Software’s&lt;/A&gt; Mobile Shell and Pocket Plus which have some nice UI enhancements built-in.&amp;nbsp; I doubt I’ll be switching from a Windows Mobile phone in the future unless something really, really cool gets released.&amp;nbsp; Once you’ve been accustomed to all of the power available on Windows Mobile it’s really hard to leave it.&amp;nbsp; I’m kind of bummed that the Instinct didn’t work out for me since I tried really hard to work with it.&amp;nbsp; I’m hoping the HTC Diamond ends up being as cool as it looks.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need to display OrgCharts, site maps or other hierarchies in your ASP.NET applications?&amp;nbsp; Check out &lt;A href="http://www.smartwebcontrols.com/" target=_blank&gt;SmartChartPro&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.smartwebcontrols.com/" target=_blank&gt;&lt;IMG src="http://www.smartwebcontrols.com/images/smartchartprologo.gif" border=0&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6407197" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Mobile/default.aspx">Mobile</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Phone/default.aspx">Phone</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Instinct/default.aspx">Instinct</category></item><item><title>Sprint Instinct Tips and Tricks</title><link>http://weblogs.asp.net/dwahlin/archive/2008/07/10/sprint-instinct-tips-and-tricks.aspx</link><pubDate>Thu, 10 Jul 2008 07:27:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6382895</guid><dc:creator>dwahlin</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6382895</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/07/10/sprint-instinct-tips-and-tricks.aspx#comments</comments><description>&lt;P&gt;&lt;IMG src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/samsung_sprint_instinct_thumb_1.jpg" align=right mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/samsung_sprint_instinct_thumb_1.jpg"&gt; In a &lt;A href="http://weblogs.asp.net/dwahlin/archive/2008/06/26/pros-and-cons-of-the-sprint-instinct-phone.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/2008/06/26/pros-and-cons-of-the-sprint-instinct-phone.aspx"&gt;previous post&lt;/A&gt; I discussed some of the pros and cons of the new Sprint Instinct phone that I recently purchased.&amp;nbsp; I’ve had the phone for a few weeks now and still like it a lot overall.&amp;nbsp; It’s not nearly as flexible as the PPC-6700 phone I had previously when it comes to installing software (a lot of applications like Opera Mini won’t work due to a virtual keyboard issue that Sprint/Samsumg will hopefully fix), but it shines in many areas where my Windows Mobile phone was severely lacking such as visual voice mail, GPS navigation, flexible touch screen interface, business search (with GPS positioning), plus more.&lt;/P&gt;
&lt;P&gt;Now that I’ve had the phone and tried out about every feature I could find I thought I’d put together a tips and tricks section for others who may have the phone.&amp;nbsp; Most of these tips and tricks I found through experimentation (I like to tinker with devices) while others I discovered using Google and Live.com.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Scrolling in the Browser &lt;/STRONG&gt;– When you’re using the Instinct’s browser you can click the camera button and move the device to scroll left to right or top to bottom.&amp;nbsp; It’s kind of a gimmick feature in my opinion since it doesn’t seem to work consistently, but it’s nice to know about.&amp;nbsp; The second icon down on the left of the browser can also be used to quickly move to different parts of&amp;nbsp; page.&amp;nbsp; A lot of people complain about the browser but it’s useable for most sites.&amp;nbsp; I really hope that Opera Mini 4.1 makes it onto the Instinct though.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Using Opera Mini&lt;/STRONG&gt; – &lt;A href="http://www.operamini.com/" target=_blank mce_href="http://www.operamini.com"&gt;Opera Mini 4.1&lt;/A&gt; (one of the coolest mobile browsers out there) doesn’t currently work on the Instinct unfortunately (as of 7/9/2008)…...bummer.&amp;nbsp; It loads the first time but no keyboard pops-up when user input is required and it doesn’t generally load more than once without uninstalling and reinstalling it.&amp;nbsp; The lack of support for keyboard input in the Instinct for existing Java applications is a problem although &lt;A href="http://sprintusers.com/forum/showthread.php?t=167813" target=_blank mce_href="http://sprintusers.com/forum/showthread.php?t=167813"&gt;rumor has it&lt;/A&gt; that Sprint/Samsung will release a fix for the problem in the future.&amp;nbsp; Although Opera Mini 4.1 doesn’t work, Opera Mini 3.0 does work and is useful when you want to view sites.&amp;nbsp; User input isn’t supported unfortunately, but you can drill down into sites and feeds provided by the browser to get to most major sites out there and then do some tricks to post your own custom bookmarks online.&amp;nbsp; More details can be found &lt;A href="http://www.sprintinstinctforum.com/forum/viewtopic.php?f=36&amp;amp;t=654" target=_blank mce_href="http://www.sprintinstinctforum.com/forum/viewtopic.php?f=36&amp;amp;t=654"&gt;here&lt;/A&gt; and &lt;A href="http://instinctbookmarks.blogspot.com/2008/06/exclusive-how-to-use-opera-mini-3-older.html" target=_blank mce_href="http://instinctbookmarks.blogspot.com/2008/06/exclusive-how-to-use-opera-mini-3-older.html"&gt;here&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Setting a Custom Desktop Wallpaper&lt;/STRONG&gt; – When the power button for the phone is clicked a default screen comes up that explains how to unlock the phone.&amp;nbsp; You can assign a custom background (such as a picture you took with the phone) to this screen by going to Main &amp;gt; Settings &amp;gt; Display &amp;gt; Background and select the picture you’d like.&amp;nbsp; You can access custom images as well quite easily by uploading them to &lt;A href="http://www.myxer.com/" target=_blank mce_href="http://www.myxer.com"&gt;Myxer.com&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Assigning a Custom Ring Tone – &lt;/STRONG&gt;I mentioned this in my previous Instinct post but it’s a nice trick to know.&amp;nbsp; An easy way to add a custom ring tone is to go to &lt;A href="http://www.myxer.com/" mce_href="http://www.myxer.com/"&gt;http://www.myxer.com&lt;/A&gt; and upload a music file, adjust which parts you want to be your ring tone and then download the file on your phone.&amp;nbsp; Read more about making custom ring tones for the Instinct &lt;A href="http://www.instinct-samsung.com/index.php/topic,407.0.html" mce_href="http://www.instinct-samsung.com/index.php/topic,407.0.html"&gt;here&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Fast Text Messages or Emails – &lt;/STRONG&gt;The Instinct has handwriting recognition support built-in that even works well with my messy handwriting.&amp;nbsp; When you’re composing an email or text message click the pencil icon to get to the handwriting recognition feature.&amp;nbsp; It supports writing complete words rather than drawing one character at a time which is nice.&amp;nbsp; I haven’t successfully used the feature with my finger, but it works well with the included stylus.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Quickly View Emails. Text Messages or Pictures – &lt;/STRONG&gt;Because the Instinct is a touch phone you can move your finger from left to right (or right to left) to move through pictures you may have on the SD card.&amp;nbsp; You can use this same technique to quickly flip through emails.&amp;nbsp; View an email that you’d like to read and swipe your finger from right to left on the screen to see the next email.&amp;nbsp; You can do this with text messages as well.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Deleting or Reordering Text Messages&lt;/STRONG&gt; – Text messages can be deleted by highlighting them and clicking the trash icon or by holding them for a moment (until the target message changes colors) and then dragging them to the trash icon.&amp;nbsp; The Instinct threads text messages and you can move messages around to change their order by using this same technique (although you wouldn’t move them to the trash icon of course!).&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Sending Voice Memos– &lt;/STRONG&gt;This is one of my favorite tips for the Instinct since I like to record &lt;A href="http://weblogs.asp.net/dwahlin/archive/tags/Music/default.aspx" target=_blank mce_href="http://weblogs.asp.net/dwahlin/archive/tags/Music/default.aspx"&gt;song ideas&lt;/A&gt; that I get from time to time so that I don’t forget them.&amp;nbsp; I’ll admit that I didn’t figure this one out on my own but read about it &lt;A href="http://www.sprintusers.com/forum/showthread.php?t=166683&amp;amp;page=7" target=_blank mce_href="http://www.sprintusers.com/forum/showthread.php?t=166683&amp;amp;page=7"&gt;here&lt;/A&gt;.&amp;nbsp; You can send yourself a voice memo quickly and easily.&amp;nbsp; To start, add yourself as a contact in the phone.&amp;nbsp; I added my name, phone number and email address.&amp;nbsp; Once your contact information is setup, click on the VoiceMail icon on the Main screen and click the + icon in the left corner.&amp;nbsp; Select yourself (or another contact) from the contact list and then record your message.&amp;nbsp; Once the message is recorded click the Send button.&amp;nbsp; This sends a Windows Media file (.wma extension) to your email address if that’s what you selected or a voice mail to yourself if you selected your phone number.&amp;nbsp; You can use this to send voice recordings to other contacts as well and they can open the wma email attachment on Windows to hear it.&amp;nbsp; If you send it to a contact’s phone number they’ll receive a text message with a phone number they can call to retrieve the message.&amp;nbsp; On a related note, there’s a free service out there called &lt;A href="http://jott.com/" target=_blank mce_href="http://jott.com/"&gt;Jott&lt;/A&gt; that converts voice messages into text/emails.&amp;nbsp; Nothing specific to the Instinct but kind of cool when you don’t want to forget something and would like to get an email about it later.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Streaming Custom TV and Audio – &lt;/STRONG&gt;The Instinct has built-in support for TV and radio stations but sometimes it’s nice to get to your own music files or TV stations.&amp;nbsp; I mentioned this in the earlier post, but the Instinct works great with &lt;A href="http://www.orb.com/" target=_blank mce_href="http://www.orb.com"&gt;orb.com&lt;/A&gt;.&amp;nbsp; If you haven’t heard of Orb, it’s a free software program you install on your home computer to allow your phone (and other computers and devices) to access your computer’s audio files and even TV stations (if TV is enabled on the PC).&amp;nbsp; Check out &lt;A href="http://www.orb.com/" target=_blank mce_href="http://www.orb.com"&gt;Orb.com&lt;/A&gt; for more details.&amp;nbsp; Once you have Orb setup on your home PC, navigate to the Orb.com site on your phone, login and go to the Settings page.&amp;nbsp; Change the Stream format to 3GP Format (.sdp) to get audio and TV streaming properly on your Instinct phone.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Upload Photos to PhotoBucket&lt;/STRONG&gt; – The Instinct’s camera works pretty well when there’s good lighting available and sooner or later you’ll want to upload pictures you take.&amp;nbsp; To upload pictures easily go to the Fun tab (on the home screen) and click the Tap to Add icon located in the bottom right-hand corner.&amp;nbsp; You’ll see a few entries including PhotoBucket (a site similar to Flickr).&amp;nbsp; Click it to add the PhotoBucket upload service to your Fun screen.&amp;nbsp; Go to your PC and create a PhotoBucket account by browsing to &lt;A href="http://www.photobucket.com/" mce_href="http://www.photobucket.com"&gt;http://www.photobucket.com&lt;/A&gt; and then click the PhotoBucket icon on the Fun tab, supply your login information and start uploading pictures.&amp;nbsp; You can also upload pictures to Facebook or Sprint’s photo service.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Finding Directions with GPS&lt;/STRONG&gt; – This tip is more obvious, but if you haven’t seen it before it’s definitely useful.&amp;nbsp; When you go to the Instinct’s Navigation screen you can click on &lt;EM&gt;Drive To&lt;/EM&gt; followed by &lt;EM&gt;Address&lt;/EM&gt; to enter the destination address.&amp;nbsp; What if you don’t know the address though?&amp;nbsp; On the bottom of the screen you’ll see &lt;EM&gt;Intersection&lt;/EM&gt; and &lt;EM&gt;City&lt;/EM&gt; tabs which are useful when you simply need to get to a specific area rather than a specific address.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Changing the Size of Email Messages&lt;/STRONG&gt; – You can change the amount of text shown in email messages by going to Main &amp;gt; Email and navigating to the Email Homepage.&amp;nbsp; Once there (and this assumes you already have an email account setup), click the Message/Gears icon to the right of the the desired email account to get to the email settings.&amp;nbsp; Click the Settings button at the bottom of the screen and then choose how much text you want to download.&amp;nbsp; I set mine to 3K of text.&amp;nbsp; I got annoyed by the ring tone that was played each time an email arrived so I also set the &lt;EM&gt;Tell me I have mail&lt;/EM&gt; setting to &lt;EM&gt;Off&lt;/EM&gt;.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Turning Off the Ringer&lt;/STRONG&gt; – It’s surprising how bad phone etiquette can be in business meetings, movies, etc.&amp;nbsp; I always try to remember (although I’ll admit I forget sometimes) to turn off my phone’s ringer where appropriate to avoid interrupting people since it’s the courteous thing to do.&amp;nbsp; You can go to Main &amp;gt; Settings &amp;gt; Volume &amp;amp; Vibration to turn down your ringer volume or go to Main &amp;gt; Settings &amp;gt; General to turn on airplane mode (which disables voice and data communications entirely).&amp;nbsp; However, the easiest way to do this is to click the down volume button (left side of the phone) several times.&amp;nbsp; As you do it you’ll see that you can switch to vibrate mode, no ringer, etc.&amp;nbsp; Click the up volume button several times to return the ringer back to normal.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;That’s it for now.&amp;nbsp; There are a lot more tips and tricks I’ve come across while using the phone which I’ll try to post in the future. If you’re an Instinct owner and have some tips/tricks you’d like to share please add a comment below.&lt;/P&gt;
&lt;P&gt;Need to display OrgCharts, site maps or other hierarchies in your ASP.NET applications?&amp;nbsp; Check out &lt;A href="http://www.smartwebcontrols.com/" mce_href="http://www.smartwebcontrols.com"&gt;SmartChartPro&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.smartwebcontrols.com/" mce_href="http://www.smartwebcontrols.com"&gt;&lt;IMG src="http://www.smartwebcontrols.com/images/smartchartprologo.gif" border=0 mce_src="http://www.smartwebcontrols.com/images/smartchartprologo.gif"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6382895" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dwahlin/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Phone/default.aspx">Phone</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Java/default.aspx">Java</category><category domain="http://weblogs.asp.net/dwahlin/archive/tags/Instinct/default.aspx">Instinct</category></item><item><title>Pros and Cons of the Sprint Instinct Phone</title><link>http://weblogs.asp.net/dwahlin/archive/2008/06/26/pros-and-cons-of-the-sprint-instinct-phone.aspx</link><pubDate>Thu, 26 Jun 2008 20:03:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6324160</guid><dc:creator>dwahlin</dc:creator><slash:comments>46</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dwahlin/rsscomments.aspx?PostID=6324160</wfw:commentRss><comments>http://weblogs.asp.net/dwahlin/archive/2008/06/26/pros-and-cons-of-the-sprint-instinct-phone.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;There’s been a lot of hype over Apple’s new &lt;A href="http://www.apple.com/iphone/" target=_blank mce_href="http://www.apple.com/iphone/"&gt;iPhone 3G&lt;/A&gt; coming out on July 11th as well as Sprint’s recently released &lt;A href="http://www.instinctthephone.com/?id12=UHP_Masthead_062008_instinctthephone" target=_blank mce_href="http://www.instinctthephone.com/?id12=UHP_Masthead_062008_instinctthephone"&gt;Instinct&lt;/A&gt; phone.&amp;nbsp; I was originally going to switch over to AT&amp;amp;T and get the iPhone but it meant switching my wife &lt;A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/samsung_sprint_instinct_4.jpg" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/samsung_sprint_instinct_4.jpg"&gt;&lt;IMG title=samsung_sprint_instinct style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=346 alt=samsung_sprint_instinct src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/samsung_sprint_instinct_thumb_1.jpg" width=267 align=right border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/samsung_sprint_instinct_thumb_1.jpg"&gt;&lt;/A&gt; over as well since we need to be able to call each other without using plan minutes.&amp;nbsp; After evaluating the cost of switching carriers we decided it wasn’t worth it since we’d have to pay $400 to get out of our Sprint contracts and my wife recently bought the PPC-6800 Windows Mobile phone which wasn’t cheap.&amp;nbsp; We’ve been very happy with Sprint’s network in our area as well.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/sprint-instinct_2.jpg" mce_href="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/sprint-instinct_2.jpg"&gt;&lt;IMG title=sprint-instinct style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=180 alt=sprint-instinct src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/sprint-instinct_thumb.jpg" width=240 align=left border=0 mce_src="http://weblogs.asp.net/blogs/dwahlin/WindowsLiveWriter/SprintInstinctProsandCons_9D36/sprint-instinct_thumb.jpg"&gt;&lt;/A&gt;Before getting the Instinct I had a PPC-6700 so I had to choose between going away from a Windows Mobile phone to a totally different type of touch screen phone that wasn’t based on Windows.&amp;nbsp; With a Windows Mobile phone you have full control over just about anything you want which is nice if you’re a power user.&amp;nbsp; But, the flexibility does come at a price.&amp;nbsp; I also had the problem of not being able to answer calls on occasion, having to reboot almost daily, poor battery life, plus a few others.&amp;nbsp; Truth be told, I really liked my Windows Mobile phone overall and would buy another one. But, after thinking things through more I came to the conclusion that I mainly used my PPC-6700 for calls, text messaging and the Web and that all of the other bells and whistles were rarely used.&amp;nbsp; I decided to give the Instinct a try since I really liked the touch screen when I tried out the demo version at the Sprint store and liked some of the features it had such as built-in GPS and streaming TV/radio support.&lt;/P&gt;
&lt;P&gt;Here’s what I really like about the Sprint Instinct:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Visual Voice Mail&lt;/STRONG&gt; – I’ve always hated skipping through message after message to get to the one I wanted to listen to.&amp;nbsp; Visual voice mail lets me see my messages just like emails, rewind and fast-forward messages just by sliding my finger on the screen, and deleting messages that I know I don’t need to listen to quickly and easily.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;GPS Navigation –&lt;/STRONG&gt; The Instinct has great GPS navigation capabilities.&amp;nbsp; 2-D and 3-D views are available, voice navigation (which includes announcing street names), directions, etc.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Nice Form Factor&lt;/STRONG&gt; – The Instinct fits into my hands much better than the PPC-6700 I had before and is really light…yet feels solid.&amp;nbsp; I suspect those with a Motorola Q or similar models won’t notice that much of a difference, but coming from a “brick” it’s really nice.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Great Touch Screen&lt;/STRONG&gt; – The touch screen on the Instinct is really, really nice.&amp;nbsp; It’s much better than I was expecting and provides “haptic” feedback.&amp;nbsp; Basically you get a little vibration each time you click something successfully on the screen.&amp;nbsp; Very nice!&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Fast Download Speeds&lt;/STRONG&gt; – From what I’ve heard, Sprint’s EV-DO Rev A network hasn’t officially been turned on yet (last I heard that would happen in July sometime) but the download speeds have been really good.&amp;nbsp; Good enough that I can stream music or TV from home using &lt;A href="http://www.orb.com/" target=_blank mce_href="http://www.orb.com"&gt;Orb&lt;/A&gt; quite easily (if you’re going to use Orb with Instinct &lt;A href="http://www.instinct-samsung.com/index.php/topic,680.0.html" target=_blank mce_href="http://www.instinct-samsung.com/index.php/topic,680.0.html"&gt;check out this post&lt;/A&gt;).&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;POP/IMAP Email&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;Access&lt;/STRONG&gt; – Some of the early reviews I saw said that you could only integrate with Web-based email accounts like Hotmail or GMail.&amp;nbsp; That’s not true at all.&amp;nbsp; I’m able to successfully access POP or IMAP email accounts easily and get nice notifications when an email arrives.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Speech to Action &lt;/STRONG&gt;– Need to find a gas station or restaurant that’s close to where you are?&amp;nbsp; Want to call or text someone? The Instinct has integrate