<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Scott Morrison</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/scmorris/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/scmorris/feed.xml</link>
    <description>The other Microsoft Scott</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:48:54 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Silverlight 4 Ships Today - With New Toolkit and Improved DataGrid</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/silverlight-4-ships-today-with-new-toolkit-and-improved-datagrid</link>
      <pubDate>Thu, 15 Apr 2010 11:20:50 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2010/04/15/silverlight-4-ships-today-with-new-toolkit-and-improved-datagrid/</guid>
      <description><![CDATA[Silverlight 4 released today, and with it came a new version of the Silverlight Toolkit and...]]></description>
      <content:encoded><![CDATA[<h1></h1>  <p>Silverlight 4 released today, and with it came a new version of the Silverlight Toolkit and several improvements to the DataGrid control.</p>  <h3>Silverlight 4</h3>  <p>See what’s new for line of business applications in Silverlight 4 in <a href="https://blogs.msdn.com/scmorris/archive/2010/03/17/mix-10-silverlight-4-business-applications.aspx">my presentation</a>.&#160; Also for more information about Silverlight 4 you can check out the <a href="https://www.microsoft.com/silverlight/faq/#features-4">FAQ</a>.</p>  <p>Get the bits here: <a title="https://www.silverlight.net/getstarted/" href="https://www.silverlight.net/getstarted/">https://www.silverlight.net/getstarted/</a></p>  <h3></h3>  <h3></h3>  <h3>New Toolkit Release</h3>  <p>There is also a new release of the Silverlight Toolkit which you can get <a href="https://silverlight.codeplex.com/releases/view/43528">here</a>.</p>  <h4>What’s New</h4>  <li><b>New</b> Charting Stacked Series for Bar, Column, Line, and Area Series </li>  <li><b>New</b> ContextMenu and ContextMenuService to allow easy right click integration </li>  <li><b>New</b> Dynamic theme switching at runtime as well as SystemColors theme </li>  <li><b>New</b> PanelDragDropTarget to allow drag and drop between panels </li>  <li>All toolkit controls can be found under a single common “toolkit” prefix when added from the Toolbox </li>  <li>Ignite improvements to allow for cross-platform support    <h3>DataGrid Improvements</h3>    <p>The DataGrid continues to improve with every release and Silverlight 4 was no exception.</p>    <h4>Star Sized Columns</h4>    <p>The DataGrid’s columns can already auto-size to their contents, or be set to a fixed numerical value.&#160; In Silverlight 4, they now can be set to * widths like the Grid layout panel.&#160; This allows one or more columns to take up the remaining width of the DataGrid eliminating the need for a horizontal scrollbar or filler column.&#160; We also spent a lot of time getting the resizing behavior just right so that resizing a mixture of star and non-star width columns behaves naturally.</p>    <h4>Improved Validation Support</h4>    <p>Silverlight 4 moved validation forward beyond the exception based model of Silverlight 3 by introducing the IDataErrorInfo and INotifyDataErrorInfo validation interfaces.&#160; The DataGrid knows how to automatically work with these interfaces, and introduces better cross-field error handling allowing users to move between invalid cells in a row when working with objects that implement these interfaces.</p>    <h4>Row-level Copy</h4>    <p>Now when a user selects a row they can copy it to the clipboard and paste the contents into other applications such as Microsoft Excel.&#160; We also introduced several ways to customize the behavior including ClipboardBindings to control the data that goes on the clipboard and a copy mode that controls if headers should be copied, or if copying should be allowed at all.</p>    <h4>Mouse Wheel Scrolling</h4>    <p>Users can now scroll through a DataGrid’s contents using the mouse wheel.</p>    <h4>RTL Support</h4>    <p>Silverlight 4 introduced bi-directional text support, and the DataGrid works as expected when the FlowDirection is set RightToLeft.</p>    <p>&#160;</p>    <p>Add to this the<strong> Row Grouping</strong> that we added in Silverlight 3 and <a href="https://blogs.msdn.com/scmorris/archive/2008/10/14/silverlight-2-datagrid-is-released.aspx">all of the great features from Silverlight 2</a> and we hope that you’ll agree that the DataGrid is a pretty powerful tool!</p>    <p></p> </li>]]></content:encoded>
    </item>
    <item>
      <title>MIX 10: Silverlight 4 Business Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/mix-10-silverlight-4-business-applications</link>
      <pubDate>Wed, 17 Mar 2010 14:57:00 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2010/03/17/mix-10-silverlight-4-business-applications/</guid>
      <description><![CDATA[Another talk, another blog post.&nbsp; As you can see, my blog posts are like my babies&hellip; in...]]></description>
      <content:encoded><![CDATA[<p>Another talk, another blog post.&nbsp; As you can see, my blog posts are like my babies&hellip; in the fact that they apparently take 9 months to make.&nbsp; I&rsquo;ll see if I can&rsquo;t speed things up next time, but we&rsquo;ll see.</p>
<p>For all of you who came to MIX, and those who are just interested in what Silverlight 4 has done for business applications, below is the content from my MIX talk.&nbsp; </p>
<p>The talk was a lot of fun, and my apologies to anyone who got turned away at the door because the room was packed.</p>
<h3>Recording</h3>
<p>You can find a recording of the talk here: <a href="https://live.visitmix.com/MIX10/Sessions/CL08" title="https://live.visitmix.com/MIX10/Sessions/CL08">https://live.visitmix.com/MIX10/Sessions/CL08</a>&nbsp;</p>
<h3>Downloads</h3>
<p>For those of you who want to follow along at home, here are the files for the demos that I showed in my presentation.</p>
<h4>What you&rsquo;ll need</h4>
<p>All demos were done using the free MIX10 Silverlight 4 RC bits and accompanying tools: </p>
<p>These include</p>
<ul>
<li>The latest <a href="https://go.microsoft.com/fwlink/?LinkID=151797">Visual Studio 2010</a> or <a href="https://www.microsoft.com/express/Downloads/#Visual_Studio_2010_Express_Downloads">Visual Web Developer Express 2010</a> </li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=141284">Silverlight 4 Tools for Visual Studio 2010</a> </li>
<li><a href="https://silverlight.net/getstarted/riaservices/">WCF RIA Services</a> </li>
<li><a href="https://silverlight.codeplex.com">Silverlight Toolkit</a> </li>
</ul>
<p>The installation instructions for all of the above and other SL4 tools can be found here: <a href="https://silverlight.net/getstarted/silverlight-4/" title="https://silverlight.net/getstarted/silverlight-4/">https://silverlight.net/getstarted/silverlight-4/</a></p>
<h4>Project</h4>
<p>You can download the samples and snippets here: <a href="https://cid-e7a27f7920b66c3f.office.live.com/self.aspx/Downloads/MIX10%5E_CL08.zip?lc=1033">https://cid-e7a27f7920b66c3f.office.live.com/self.aspx/Downloads/MIX10%5E_CL08.zip?lc=1033</a>&nbsp;<span style="color: #ffffff;"><span style="text-decoration: line-through;">https://drop.io/MIX10CL08/asset/mix10-cl08-zip</span></span></p>
<h4>Notes</h4>
<p><strong>Building and Running Either the Final or Start Project</strong></p>
<ol>
<li>If you are getting a &ldquo;Visual Studio Project Sample Loading Error&rdquo; it is because you need to unblock the zip file.&nbsp; Directions on how to do that can be found <a href="https://blogs.msdn.com/brada/archive/2009/12/11/visual-studio-project-sample-loading-error-assembly-could-not-be-loaded-and-will-be-ignored-could-not-load-file-or-assembly-or-one-of-its-dependencies-operation-is-not-supported-exception-from-hresult-0x80131515.aspx">here</a></li>
<li>The dlls for any broken References can be found in the Project&rsquo;s Lib directory</li>
<li>There are a few known issues that you might run into that have been fixed in later bits</li>
</ol>
<p><strong>Recreating the Project From the Start Folder</strong></p>
<ol>
<li>If your DataSources window is empty, try building</li>
<li>The Toolkit dlls are included to allow the sample to run and shouldn&rsquo;t be used outside of the sample.&nbsp; The fully supported dlls will be shipping in the next Toolkit drop which ships alongside Silverlight 4 RTW.</li>
<li>The designer files for the Toolkit were not included in the project, so the Charting section is likely to not work as smoothly as in the video.&nbsp; As mentioned when the supported Toolkit is used such issues will not be present.</li>
</ol>
<h4>Slides</h4>
<p>You can download the slides <a href="https://ecn.channel9.msdn.com/o9/mix/10/pptx/CL08.pptx" title="PPT">here</a></p>
<p>&nbsp;</p>
<h3>What we covered:</h3>
<p>We covered an huge amount of content but we still didn&rsquo;t even cover all of the new features for LOB in Silverlight 4.</p>
<h4>Displaying data</h4>
<ul>
<li>WCF .NET RIA Services </li>
<li>Data Sources Window </li>
<li>DataGrid Column Editor </li>
<li>Binding enhancements </li>
<li>DataGrid enhancements </li>
<li>DataForm </li>
<li>Sorting </li>
<li>Grouping </li>
<li>Charts </li>
</ul>
<h4>Professional look and feel</h4>
<ul>
<li>ICommand </li>
<li>Right-Click </li>
<li>Context Menu * </li>
<li>Implicit Styles </li>
<li>Theme switching * </li>
<li>Mouse wheel support in list controls </li>
</ul>
<h4>Getting user input</h4>
<ul>
<li>Webcam </li>
<li>Drag &amp; Drop </li>
</ul>
<h4>Validating user input</h4>
<ul>
<li>INotifyDataErrorInfo </li>
<li>Cross-field Validation </li>
<li>Async Validation </li>
</ul>
<h4>Saving data and sharing it</h4>
<ul>
<li>Clipboard </li>
<li>Printing </li>
</ul>
<p>* Coming in the next drop of the Toolkit</p>]]></content:encoded>
    </item>
    <item>
      <title>Tech Ed 2009 Demo Files</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/tech-ed-2009-demo-files</link>
      <pubDate>Mon, 18 May 2009 02:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2009/05/18/tech-ed-2009-demo-files/</guid>
      <description><![CDATA[It is always a blast to talk at Tech Ed and this year was no different.&nbsp; It was great to get to...]]></description>
      <content:encoded><![CDATA[<P>It is always a blast to talk at Tech Ed and this year was no different.&nbsp; It was great to get to meet many of you and hear how you are using DataGrid, DataForm, Validation, and RIA Services in your projects today.&nbsp; </P>
<P>As promised, here are the files for the demos that I showed in my presentations.</P>
<P>All demos were done on the MIX’09 Silverlight Beta bits and accompanying tools:</P>
<UL>
<LI>VS 2008 SP1 </LI>
<LI><A href="https://www.microsoft.com/express/sql/download/" mce_href="https://www.microsoft.com/express/sql/download/">Sql Express 2008</A> </LI>
<LI><A href="https://code.msdn.microsoft.com/RiaServices" mce_href="https://code.msdn.microsoft.com/RiaServices">.NET RIA Services March '09 Preview</A> </LI>
<LI><A href="https://silverlight.net/getstarted/silverlight3/default.aspx" mce_href="https://silverlight.net/getstarted/silverlight3/default.aspx">Silverlight 3 Beta</A> </LI></UL>
<P><STRONG>WUX 303: Building Data-Driven RIAs with Microsoft ASP.NET and Microsoft Silverlight</STRONG></P>
<P>What we covered:</P>
<UL>
<LI>Navigation, browser integration, permalinks </LI>
<LI>Domain methods, filtering, paging, grouping, sorting </LI>
<LI>Adding validation metadata </LI>
<LI>Windows Authentication </LI>
<LI>Writing a different view in ASP.Net and SEO </LI></UL>
<P>Watch It: (<EM>Right now it is restricted to Tech Ed attendees</EM>)</P>
<P><A href="https://www.msteched.com/online/view.aspx?tid=ff4f56fc-ff74-4a68-90a8-33c69b0acecc">https://www.msteched.com/online/view.aspx?tid=ff4f56fc-ff74-4a68-90a8-33c69b0acecc</A></P>
<P>Files:</P>
<P><IFRAME style="BORDER-BOTTOM: #dde5e9 1px solid; BORDER-LEFT: #dde5e9 1px solid; PADDING-BOTTOM: 0px; BACKGROUND-COLOR: #ffffff; MARGIN: 3px; PADDING-LEFT: 0px; WIDTH: 94px; PADDING-RIGHT: 0px; HEIGHT: 94px; BORDER-TOP: #dde5e9 1px solid; BORDER-RIGHT: #dde5e9 1px solid; PADDING-TOP: 0px" marginHeight=0 src="https://cid-e7a27f7920b66c3f.skydrive.live.com/embedgrid.aspx/Downloads/WUX303.zip" frameBorder=0 marginWidth=0 scrolling=no mce_src="https://cid-e7a27f7920b66c3f.skydrive.live.com/embedgrid.aspx/Downloads/WUX303.zip"></IFRAME></P>
<P><STRONG>WUX 308: Delivering Rich User Experiences for Business Applications with Microsoft Silverlight 3</STRONG></P>
<P>What we covered:</P>
<UL>
<LI>Customizing the DataGrid: TemplateColumns, Row Details, events in template columns </LI>
<LI>Charts </LI>
<LI>Custimizing the DataForm: Using the Display attribute, the Display / Edit templates </LI>
<LI>Writing a custom cross-field validation method</LI>
<LI>Export to Excel </LI>
<LI>DataGrid Copy / Paste with Excel </LI>
<LI>Going out of browser </LI></UL>
<P>Watch It: (<EM>Right now it is restricted to Tech Ed attendees</EM>)</P>
<P><A href="https://www.msteched.com/online/view.aspx?tid=b35f4684-54b2-4da5-9a70-663f79dd9ab7">https://www.msteched.com/online/view.aspx?tid=b35f4684-54b2-4da5-9a70-663f79dd9ab7</A>&nbsp;</P>
<P>Files:</P>
<P><IFRAME style="BORDER-BOTTOM: #dde5e9 1px solid; BORDER-LEFT: #dde5e9 1px solid; PADDING-BOTTOM: 0px; BACKGROUND-COLOR: #ffffff; MARGIN: 3px; PADDING-LEFT: 0px; WIDTH: 94px; PADDING-RIGHT: 0px; HEIGHT: 94px; BORDER-TOP: #dde5e9 1px solid; BORDER-RIGHT: #dde5e9 1px solid; PADDING-TOP: 0px" marginHeight=0 src="https://cid-e7a27f7920b66c3f.skydrive.live.com/embedgrid.aspx/Downloads/WUX308.zip" frameBorder=0 marginWidth=0 scrolling=no mce_src="https://cid-e7a27f7920b66c3f.skydrive.live.com/embedgrid.aspx/Downloads/WUX308.zip"></IFRAME></P>
<P><STRONG>Note:</STRONG> If you get a reference error for the Activity control, re-add the dll that is included in the zip.</P>
<P>Enjoy!</P>]]></content:encoded>
    </item>
    <item>
      <title>Silverlight 2 DataGrid December 2008 Release</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/silverlight-2-datagrid-december-2008-release</link>
      <pubDate>Fri, 19 Dec 2008 15:22:00 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/12/19/silverlight-2-datagrid-december-2008-release/</guid>
      <description><![CDATA[Since we released the first version of the DataGrid in October we have been listening to your...]]></description>
      <content:encoded><![CDATA[<P>Since we released the first version of the DataGrid in October we have been listening to your feedback and have an early holiday gift to give.&nbsp; </P>
<P>Today we are releasing an updated DataGrid that contains almost 30 fixes to the top issues that we heard, including:</P>
<UL>
<LI>Rows containing focus no longer disappear when the ItemsSource changes </LI>
<LI>ComboBox and other controls opening a popup now work as expected when set as cell content&nbsp;</LI>
<LI>DataGrid Selection is preserved when sorting </LI>
<LI>Buttons outside the DataGrid work as expected when they are clicked while the DataGrid is in editing mode </LI>
<LI>Improved FrozenColumn behavior</LI>
<LI>Improved cell currency</LI>
<LI>SelectedItem is updated before the CurrentCellChanged event is raised</LI>
<LI>Many more... </LI></UL>
<P>For the full list of fixes check out this <A target=_blank href="https://silverlight.net/forums/t/59990.aspx" mce_href="https://silverlight.net/forums/t/59990.aspx">post by Brian Braeckel</A> one of our DataGrid developers.</P>
<H4>Breaking Changes</H4>
<P>As a result of these fixes there are several behavioral breaking changes that you should consider before upgrading:</P>
<OL>
<LI>FrozenColumnCount now takes hidden columns into account.&nbsp; Previously, only the first columns with Visibility set to Visible were included in the range of frozen columns.&nbsp; A column with Visibility set to Collapsed can now be considered frozen even though it isn’t visible.&nbsp; This is to ensure that a column’s DisplayIndex corresponds with the DataGrid’s FrozenColumnCount (i.e. if FrozenColumnCount == 3, columns with DisplayIndex &lt; 3 are considered frozen).</LI>
<LI>The DataGrid’s current cell is now kept in sync with an ICollectionView’s notion of currency.&nbsp; Moving the current position or changing the current item of an ICollectionView will now move the current cell and selected item of a DataGrid, and vice versa.&nbsp; For this to work, the DataGrid’s ItemsSource must be set to a collection that fully implements ICollectionView.</LI>
<LI>A developer can now programmatically reorder a non-frozen column to the frozen column range (and vice versa) by changing a column’s DisplayIndex.&nbsp; The DataGrid used to throw an exception in these cases.&nbsp; An end-user, however, is still unable to do this through the UI by dragging column headers.</LI></OL>
<H4>Installation Instructions</H4>
<P>Visit the <A target=_blank href="https://www.microsoft.com/downloads/details.aspx?FamilyID=084a1bb2-0078-4009-94ee-e659c6409db0" mce_href="https://www.microsoft.com/downloads/details.aspx?FamilyID=084a1bb2-0078-4009-94ee-e659c6409db0">Silverlight 2 DataGrid December 2008 Release</A> download page and follow the installation instructions carefully.&nbsp; </P>
<P><STRONG>In order to use the new DataGrid you need to do all of the following:</STRONG></P>
<OL>
<LI>Close all instances of Microsoft Visual Studio. </LI>
<LI>Delete all cached toolbox items by removing all files beginning with "toolbox" from %LocalAppData%\Microsoft\VisualStudio\9.0. 
<UL>
<LI>On Microsoft Windows XP, %LocalAppData% is Documents and Settings\<I>UserName</I>\Local Settings\Application Data. </LI>
<LI>On Microsoft Windows Vista, %LocalAppData% is Users\<I>UserName</I>\AppData\Local. </LI></UL></LI>
<LI>Replace the following assemblies with the ones contained in the package in the link above: 
<UL>
<LI>%ProgramFiles%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client\System.Windows.Controls.Data.dll </LI>
<LI>%ProgramFiles%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client\System.Windows.Controls.Data.Design.dll </LI></UL></LI>
<LI>For any existing projects, delete the reference to System.Windows.Controls.Data.dll and then re-add the reference.</LI></OL>
<P>We hope you enjoy the update and we look forward to bringing great new things to future versions of the DataGrid.</P>]]></content:encoded>
    </item>
    <item>
      <title>Freezing Columns in the Silverlight DataGrid</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/freezing-columns-in-the-silverlight-datagrid</link>
      <pubDate>Wed, 15 Oct 2008 04:47:48 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/10/15/freezing-columns-in-the-silverlight-datagrid/</guid>
      <description><![CDATA[Freezing columns is just one of the many things you can do with the Silverlight DataGrid. Read...]]></description>
      <content:encoded><![CDATA[<p></p>  <p>Freezing columns is just one of the many things you can do with the Silverlight DataGrid. <a href="https://blogs.msdn.com/scmorris/archive/2008/10/14/silverlight-2-datagrid-is-released.aspx" target="_blank">Read more about the features that the Silverlight 2 DataGrid has to offer...</a></p>  <h3>Freezing Columns</h3>  <p>Have you ever been working with a large enough number of columns that you get horizontal scrolling, but you want some of the columns to not scroll?&#160; Think of a column such as Employee Name that you want to remain visible while you scroll through ten weeks of sales data.&#160; You might want to see which employee had the best sales for week 4.&#160; Since the Employee column is on the far left, any amount of scrolling causes it to scroll out of view, that is unless you freeze it.&#160; This causes it to not scroll and always be visible putting your other data in context.</p>  <p>&#160; <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="286" alt="FrozenColumns" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/FreezingColumnsintheSilverlightDataGrid_1476/FrozenColumns_74cfdd55-a1fa-4b2e-a60d-66c6efd58332.png" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/FreezingColumnsintheSilverlightDataGrid_1476/FrozenColumns_74cfdd55-a1fa-4b2e-a60d-66c6efd58332.png" width="504" border="0" /> </p>  <p>To freeze columns, you simply set the <strong>FrozenColumnCount</strong> property on the DataGrid to the number of columns you want to freeze.&#160; For instance, to freeze the Employee column pictured above, you would write:</p>  <p><strong>C#</strong></p>  <pre class="code">employeeSalesGrid.FrozenColumnCount = 1;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>VB</strong></p>

<pre class="code">EmployeeSalesGrid.FrozenColumnCount = 1</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>IsFrozen</strong></p>

<p>If you are programmatically working with a column and want to know if it is frozen or not, you can check the IsFrozen property on the Column.&#160; This is a readonly property that will let you know if the column you are working with is frozen.</p>]]></content:encoded>
    </item>
    <item>
      <title>Post Beta 2 Breaking Changes</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/post-beta-2-breaking-changes</link>
      <pubDate>Wed, 15 Oct 2008 03:23:30 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/10/15/post-beta-2-breaking-changes/</guid>
      <description><![CDATA[As mentioned we made some changes, hopefully for the better, to the DataGrid API since Beta 2.&#160;...]]></description>
      <content:encoded><![CDATA[<p>As mentioned we made some changes, hopefully for the better, to the DataGrid API since Beta 2.&#160; Special thanks to our developer Yifung Lin for compiling this list:</p>  <h3>DataGrid breaking changes</h3>  <h4><b>DisplayMemberBinding renamed to Binding</b></h4>  <p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>  <h5>Summary</h5>  <p>DisplayMemberBinding wasn&#8217;t an ideal name, but we used it because WPF has some precedence with it.&#160; This breaks down in scenarios where there is a separate Binding for display like in ComboBox scenarios since our Binding is actually the property field binding as opposed to the display binding.</p>  <h5>Fix Required</h5>  <p>Users using DataGridBoundColumn will need to change DisplayMemberBinding to Binding.</p>  <p><strong>Beta 2</strong></p>  <p>[Xaml]</p>  <pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">DisplayMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">FirstName</span><span style="color: blue">}&quot; /&gt;
</span></pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[Xaml]</p>

<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">FirstName</span><span style="color: blue">}&quot; /&gt;</span></pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>DataGrid has VSM support</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>The DataGrid now supports the Visual State Manager.</p>

<h5><strong>Fix Required</strong></h5>

<p>Custom DataGrid templates need to be updated.&#160; The new templates can be found at: <a href="https://msdn.microsoft.com/library/cc278066(vs.95).aspx">https://msdn.microsoft.com/library/cc278066(vs.95).aspx</a></p>

<p>&#160;</p>

<h4><b>IEditableObject moved to System.ComponentModel namespace</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>In the full framework IEditableObject is part of the System.ComponentModel namespace and it is located in System.dll&#160; For Silverlight, it was temporarily in the System.Windows.Controls.Data.dll under the System.Windows.Controls namespace.&#160; It now&#160; matches the full framework.</p>

<h5>Fix Required</h5>

<p>Users using IEditableObject need to update the namespace.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">using </span>System.Windows.Controls;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">using </span>System.ComponentModel;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>SelectionChanged event changed from EventHandler to SelectionChangedEventHandler</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>Using SelectionChangedEventHandler allows the user to access OldItems and NewItems.</p>

<h5>Fix Required</h5>

<p>The signature for the SelectionChanged event handler needs to be updated.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">void </span>SelectionChanged(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
{

}</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">void </span>SelectionChanged(<span style="color: blue">object </span>sender, <span style="color: #2b91af">SelectionChangedEventArgs </span>e)
{

}</pre>
<a href="https://11011.net/software/vspaste"></a>

<h4>
  <p></p>

  <h4>&#160;</h4>

  <p></p>
</h4>

<h4>DataGridHeaders enum renamed to DataGridHeadersVisibility</h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>DataGridHeadersVisibility is a better indication of what the enum is.</p>

<h5>Fix Required</h5>

<p>DataGridHeaders -&gt; DataGridHeadersVisibility.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code">dataGrid.HeadersVisibility = <span style="color: #2b91af">DataGridHeaders</span>.Column;</pre>
<a href="https://11011.net/software/vspaste"></a><a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code">dataGrid.HeadersVisibility = <span style="color: #2b91af">DataGridHeadersVisibility</span>.Column;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>DataGridAutoGeneratingColumnEventArgs change</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>The PropertyInfo of DataGridAutoGeneratingColumnEventArgs was changed to PropertyName and PropertyType.</p>

<h5>Fix Required</h5>

<p>Update to use PropertyName and PropertyType.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">string </span>name = e.Property.Name;
<span style="color: #2b91af">Type </span>type = e.Property.Type;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">string </span>name = e.PropertyName;
<span style="color: #2b91af">Type </span>type = e.PropertyType;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>DataGridColumn GenerateElement and GenerateEditingElement now take in the cell</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>GenerateElement and GenerateEditingElement now provide the containing cell</p>

<h5>Fix Required</h5>

<p>Update signature.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">protected override </span><span style="color: #2b91af">FrameworkElement </span>GenerateEditingElement(<span style="color: blue">object </span>dataItem)
{

}

<span style="color: blue">protected override </span><span style="color: #2b91af">FrameworkElement </span>GenerateElement(<span style="color: blue">object </span>dataItem)
{ 

}</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">protected override </span><span style="color: #2b91af">FrameworkElement </span>GenerateEditingElement(<span style="color: #2b91af">DataGridCell </span>cell, <span style="color: blue">object </span>dataItem)
{

}

<span style="color: blue">protected override </span><span style="color: #2b91af">FrameworkElement </span>GenerateElement(<span style="color: #2b91af">DataGridCell </span>cell, <span style="color: blue">object </span>dataItem)
{ 

}</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>DataGridColumnReorderingEventArgs changed</b></h4>

<p><strong>Who Is Affected:</strong> Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>The following modifications were made to the DataGridColumnReorderingEventArgs:</p>

<p><b>Old</b>:</p>

<pre class="code"><span style="color: blue">public object </span>DragIndicatorContent { <span style="color: blue">get</span>; set}
<span style="color: blue">public </span><span style="color: #2b91af">FrameworkElement </span>DropLocationIndicator { <span style="color: blue">get</span>; set}</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><b>New</b>:</p>

<pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">Control </span>DragIndicator { <span style="color: blue">get</span>; set}
<span style="color: blue">public </span><span style="color: #2b91af">Control </span>DropLocationIndicator { <span style="color: blue">get</span>; set}</pre>
<a href="https://11011.net/software/vspaste"></a>

<h5>Fix Required</h5>

<p>Update to use DragIndicator.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: blue">object </span>dragIndicator = e.DragIndicatorContent;
<span style="color: #2b91af">FrameworkElement </span>dropIndicator = e.DropLocationIndicator;</pre>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code"><span style="color: #2b91af">Control </span>dragIndicator = e.DragIndicator;
<span style="color: #2b91af">Control </span>type = e.DropLocationIndicator;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>DataGrid.CancelingEdit and DataGrid.CommittingEdit events removed</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>Explicit Binding is required to implement these 2 events correctly.&#160; Since the Silverlight Binding does not support explicit Bindings, these events were removed.&#160; They will be resurrected when explicit Binding is supported.</p>

<h5>Fix Required</h5>

<p>The DataGrid.CancelingEdit and the DataGrid.CommittingEdit events can no longer be used.&#160; It is recommended that you use IEditableObject to track when a commit has occurred.</p>

<p>&#160;</p>

<h4><b>DataGrid.DataError event removed</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>The concept of a DataError event was taken from Winforms.&#160; This does not fit well into the WPF model so the event was removed.</p>

<h5>Fix Required</h5>

<p>The DataGrid.DataError event can no longer be used.</p>

<p>&#160;</p>

<h4><b>DataGridColumn.Header no longer supports visuals</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>Visuals cannot be duplicated so they cannot be used for the Header property due to column reordering.</p>

<h5>Fix Required</h5>

<p>To put visuals in column headers, users will need to use the header's ContentTemplate to include the visual instead of setting it as the Header.</p>

<p><strong>Beta 2</strong></p>

<p>[Xaml]</p>

<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">DisplayMemberBinding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">FirstName</span><span style="color: blue">}&quot;&gt;
    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn.Header</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Button </span><span style="color: red">Content</span><span style="color: blue">=&quot;hello&quot; /&gt;
    &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn.Header</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn</span><span style="color: blue">&gt;</span></pre>
<a href="https://11011.net/software/vspaste"></a><a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[Xaml]</p>

<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">LastName</span><span style="color: blue">}&quot; </span><span style="color: red">Header</span><span style="color: blue">=&quot;hello&quot;&gt;
    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn.HeaderStyle</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Style </span><span style="color: red">TargetType</span><span style="color: blue">=&quot;dataprimitives:DataGridColumnHeader&quot;&gt;
            &lt;</span><span style="color: #a31515">Setter </span><span style="color: red">Property</span><span style="color: blue">=&quot;ContentTemplate&quot;&gt;
                &lt;</span><span style="color: #a31515">Setter.Value</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: #a31515">DataTemplate</span><span style="color: blue">&gt;
                        &lt;</span><span style="color: #a31515">Button </span><span style="color: red">Content</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding</span><span style="color: blue">}&quot; /&gt;
                    &lt;/</span><span style="color: #a31515">DataTemplate</span><span style="color: blue">&gt;
                &lt;/</span><span style="color: #a31515">Setter.Value</span><span style="color: blue">&gt;
            &lt;/</span><span style="color: #a31515">Setter</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">Style</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn.HeaderStyle</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn</span><span style="color: blue">&gt;
</span></pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>Root element of DataGridRow changed from Grid to DataGridFrozenGrid</b></h4>

<p><strong>Who Is Affected:</strong> Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>DataGridFrozenGrid derives from Grid and it contains an IsFrozen attached property.&#160; Users can use IsFrozen to specify parts of the Row that are frozen</p>

<h5>Fix Required</h5>

<p>Custom DataGridRow templates need to use DataGridFrozenGrid as the root element instead of Grid.</p>

<p>&#160;</p>

<h4><b>Gridline renamed to GridLine</b></h4>

<p><strong>Who Is Affected:</strong> Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>Gridline would be appropriate if it was a word.&#160; MS Word says it is, but the dictionary says it&#8217;s not.&#160; WPF has precedence with GridLine so we went with that.</p>

<h5>Fix Required</h5>

<p>All instances of Gridline need to be renamed to GridLine.</p>

<p><strong>Beta 2</strong></p>

<p>[c#]</p>

<pre class="code">dataGrid.GridlinesVisibility = <span style="color: #2b91af">DataGridGridlinesVisibility</span>.All;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>RTM</strong></p>

<p>[c#]</p>

<pre class="code">dataGrid.GridLinesVisibility = <span style="color: #2b91af">DataGridGridLinesVisibility</span>.All;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>&#160;</p>

<h4><b>Template only controls moved to primitives namespace</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>These types moved from the System.Windows.Controls namespace to the System.Windows.Controls.Primitives namespace:</p>

<ul>
  <li>DataGridCellsPresenter </li>

  <li>DataGridColumnHeadersPresenter </li>

  <li>DataGridDetailsPresenter </li>

  <li>DataGridRowsPresenter </li>

  <li>DataGridColumnHeader </li>

  <li>DataGridRowHeader </li>
</ul>

<h5>Fix Required</h5>

<p>The types above need to be referenced using the System.Windows.Controls.Primitives namespace.</p>

<p>&#160;</p>

<h4><b>DataGridCheckBoxColumn.Content was removed</b></h4>

<p><strong>Who Is Affected: </strong>Silverlight 2 Beta 2 managed applications that use the DataGrid.</p>

<h5>Summary</h5>

<p>The Content property was not useful for mainline scenarios so it was removed. </p>

<h5>Fix Required</h5>

<p>The DataGridCheckBoxColumn.Content property can no longer be used.&#160; In rare scenarios where it is needed, users can template the CheckBox through ElementStyle and EditingElementStyle</p>]]></content:encoded>
    </item>
    <item>
      <title>Silverlight 2 DataGrid is Released</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/silverlight-2-datagrid-is-released</link>
      <pubDate>Wed, 15 Oct 2008 02:43:53 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/10/15/silverlight-2-datagrid-is-released/</guid>
      <description><![CDATA[As you might have heard, we just released Silverlight 2, and with it the first version of the...]]></description>
      <content:encoded><![CDATA[<p><a href="https://weblogs.asp.net/scottgu/archive/2008/10/14/silverlight-2-released.aspx" target="_blank">As you might have heard</a>, we just released <a href="https://silverlight.net/GetStarted/" target="_blank">Silverlight 2</a>, and with it the first version of the Silverlight DataGrid!&#160; We have been building this for a while, giving the first glimpse of it last March in Silverlight 2 Beta 1, and tweaking it ever since based on your feedback.&#160; We were able to pack a lot of great features into it, and I look forward to hearing from you what features you want next!&#160; </p>  <p>In celebration of its release, all of the <a href="https://blogs.msdn.com/scmorris/archive/tags/DataGrid/default.aspx" target="_blank">previous walkthroughs</a> have been updated to work with the RTW bits, and new walkthroughs are on their way.&#160; </p>  <p>Also, if you have never used the Silverlight DataGrid before, <a href="https://blogs.msdn.com/scmorris/archive/2008/03/21/using-the-silverlight-datagrid.aspx" target="_blank">here is a good place to start</a>.</p>  <h3>What's New?</h3>  <p>You might be wondering what has changed since Beta 2:</p>  <table width="100%"><tbody>     <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="172" alt="Automation" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Automation_6e110932-8a7c-49c1-937d-19738ae80695.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Automation_6e110932-8a7c-49c1-937d-19738ae80695.jpg" width="129" border="0" /> </td>        <td>         <h4>Accessibility: </h4>          <p>One of the biggest features that we have added since Beta 2 is the addition of an automation peer framework which allows the DataGrid to work well with screen readers.</p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="VSM" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/VSM_0b87db00-ad2f-4a15-816c-31009eab0d9a.png" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/VSM_0b87db00-ad2f-4a15-816c-31009eab0d9a.png" width="129" border="0" /> </td>        <td>         <h4>Support for the VSM: </h4>          <p>The Visual State Manager (VSM) is a tool that allows designers to customize how a control looks in various states, and the animations used to switch between these states.</p>          <p><a href="https://blogs.msdn.com/expression/archive/2008/07/11/more-articles-on-visual-state-manager.aspx" target="_blank">Read more about the Visual State Manager...</a></p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="Performance" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Performance_9c404d48-3526-468a-a786-78787e8426b2.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Performance_9c404d48-3526-468a-a786-78787e8426b2.jpg" width="129" border="0" /> </td>        <td>         <h4>Performance, Performance, Performance:</h4>          <p>We have done a lot in this area to try to get the DataGrid running as fast as possible. If the last time you used it was in Beta 1 or even Beta 2, you should definitely take another look. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 5px 10px 10px 0px; border-right-width: 0px" height="179" alt="API" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/API_823651ff-5015-4b74-81d8-acb4af779c64.png" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/API_823651ff-5015-4b74-81d8-acb4af779c64.png" width="129" border="0" /> </td>        <td>         <h4>API Improvements: </h4>          <p>Based on your feedback, we took another pass through the API in an effort to simplify it more and give you more control over the DataGrid.</p>          <p><a href="https://blogs.msdn.com/scmorris/archive/2008/10/15/post-beta-2-breaking-changes.aspx">Read about the Breaking Changes since Beta 2...</a></p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="NewLook" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/NewLook_7a03c298-9617-4f06-a031-deb31c6ae7a2.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/NewLook_7a03c298-9617-4f06-a031-deb31c6ae7a2.jpg" width="129" border="0" /> </td>        <td>         <h4>Great New Look: </h4>          <p>The entire framework got a visual upgrade since Beta 2, and the DataGrid is no exception.</p>       </td>     </tr>   </tbody></table>  <h3>What's Else Can It Do?</h3>  <p>For those of you new to the Silverlight DataGrid, here is a quick rundown of what it could already do:</p>  <table><tbody>     <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="AutoSized" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/AutoSized_e44a613e-8c5e-4f25-b20e-795402123c8c.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/AutoSized_e44a613e-8c5e-4f25-b20e-795402123c8c.jpg" width="129" border="0" /> </td>        <td>         <h4>Auto-sizing: </h4>          <p>Everything in the DataGrid can be auto-sized.&#160; That includes the DataGrid itself, Columns, Rows, Headers, and Row Details meaning that you do not have to worry about the size of what you are putting into the DataGrid, it will grow to accommodate it. </p>          <p><a href="https://blogs.msdn.com/scmorris/archive/2008/06/10/auto-sizing-the-silverlight-datagrid.aspx" target="_blank">Read more about Auto-sizing...</a></p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="NewLook" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/NewLook_7a03c298-9617-4f06-a031-deb31c6ae7a2.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/NewLook_7a03c298-9617-4f06-a031-deb31c6ae7a2.jpg" width="129" border="0" /></td>        <td>         <h4>Sorting:</h4>          <p>Any time you bind the DataGrid to a collection that implements IList such as a List&lt;T&gt; you now get sorting for free.&#160; Even better, sorting isn't limited to a single column, but end users can sort by multiple columns by holding Shift and clicking on additional column headers. As an RTM improvement, you can also choose which columns you want to support sorting. </p>          <p><a href="https://blogs.msdn.com/scmorris/archive/2008/06/10/sorting-data-in-the-silverlight-datagrid.aspx" target="_blank">Read more about Sorting...</a></p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="Reorder" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Reorder_6f7d9d77-5d26-42ff-b902-db9b42c4545c.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Reorder_6f7d9d77-5d26-42ff-b902-db9b42c4545c.jpg" width="129" border="0" />&#160;</td>        <td>         <h4><strong>Column Reordering:</strong> </h4>          <p>End users can reorder columns at runtime just by dragging a column's header, and developers can control not only the order, but the appearance of the reordering UI as well as the behavior. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="Resize" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Resize_47ad8959-cc35-4692-ba31-1e6071c20500.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Resize_47ad8959-cc35-4692-ba31-1e6071c20500.jpg" width="129" border="0" /></td>        <td>         <h4>Column Resizing:</h4>          <p>Just like reordering, and sorting, end users can control the size of columns at runtime. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="FrozenColumns" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/FrozenColumns_88b4d009-55d1-4d33-bb3f-6ac4d82c9a34.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/FrozenColumns_88b4d009-55d1-4d33-bb3f-6ac4d82c9a34.jpg" width="129" border="0" /> </td>        <td>         <h4>Frozen Columns: </h4>          <p>This is a semi-advanced feature, but once you know about it you'll be surprised at how useful it can be.&#160; A frozen column does not scroll horizontally but rather is &quot;frozen&quot; in place.&#160; This is the same as the Freeze Column feature in Excel. </p>          <p><a href="https://blogs.msdn.com/scmorris/archive/2008/10/15/freezing-columns-in-the-silverlight-datagrid.aspx" target="_blank">Read more about Freezing Columns...</a></p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="RowDetails" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/RowDetails_4756094e-f1fb-47c8-9b28-d2ffd9d5568b.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/RowDetails_4756094e-f1fb-47c8-9b28-d2ffd9d5568b.jpg" width="129" border="0" /> </td>        <td>         <h4>Row Details:</h4>          <p>This feature is one that we are very excited about.&#160; In short, it is an area in each row that allows you to put any UI you want that spans all columns.&#160; This could be anything from form-based entry to the contents of a column that would do better if given more space. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="AutoGeneration" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/AutoGeneration_f9a4fdae-ca3b-4a43-a0e6-f4f2e5095f00.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/AutoGeneration_f9a4fdae-ca3b-4a43-a0e6-f4f2e5095f00.jpg" width="129" border="0" /> </td>        <td>         <h4>Auto-Generation of Columns: </h4>          <p>A great feature to help get an application up and running quickly, auto-generation of columns creates a column for every property on the item that it is bound to. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="Skinnable" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Skinnable_7ef3c20c-c8d0-4e06-8011-c91ea20312f1.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Skinnable_7ef3c20c-c8d0-4e06-8011-c91ea20312f1.jpg" width="129" border="0" /> </td>        <td>         <h4>Highly Customizable Visuals: </h4>          <p>The look of the Silverlight 2 DataGrid has been improved, but it doesn't mean that you can't change it.&#160; Every aspect of the DataGrid's appearance can be retemplated to create a drastically different looking DataGrid that maintains all of the great features listed here. </p>          <p><a href="https://blogs.msdn.com/corrinab/archive/tags/Control+Skins/default.aspx" target="_blank">Read more about Customizing Control Visuals...</a></p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="Edit" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Edit_bda5e11f-8a67-4069-924f-8622238b3265.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Edit_bda5e11f-8a67-4069-924f-8622238b3265.jpg" width="129" border="0" /> </td>        <td>         <h4>Editable: </h4>          <p>The DataGrid control allows your users to edit the data that it is bound to.&#160; One benefit of the Silverlight DataGrid is that it gives you control over what control is used to display the data for each cell, and what control is used to edit the data for each cell even if they are different.&#160; The customization is easy, and it handles switching between the two when the user wants to go into edit mode. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="Scrollable" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Scrollable_84ca9a5d-bc1a-4a2d-b661-86228676f592.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/Scrollable_84ca9a5d-bc1a-4a2d-b661-86228676f592.jpg" width="129" border="0" /> </td>        <td>         <h4>Scrollable: </h4>          <p>Another benefit that the DataGrid provides is the ability to scroll through long lists of data.&#160; The DataGrid does a lot behind the scenes to make this experience as smooth as possible for your users even when you have a large number of rows.&#160; You can also scroll columns and items into view to make sure that an item you want to highlight to your user is visible on screen. </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="MultiSelect" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/MultiSelect_a1331575-053a-42c2-92e9-ba14cf240c67.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/MultiSelect_a1331575-053a-42c2-92e9-ba14cf240c67.jpg" width="129" border="0" /> </td>        <td>         <h4>Multi-Selection:</h4>          <p>The DataGrid provides both single as well as extended selection modes, allowing you to choose if you want users to be able to select more than one row at a time </p>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="179" alt="ColumnTypes" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/ColumnTypes_b1abe567-c622-478b-9f89-1078b06cb815.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/ColumnTypes_b1abe567-c622-478b-9f89-1078b06cb815.jpg" width="129" border="0" /> </td>        <td>         <h4>Built-in Column Types: </h4>          <p>Out of the box you can use both Text columns as well as CheckBox columns, and creating your own column types is easy.</p>          <p>Read more about using the Built-in Column Types:</p>          <ul>           <li><a href="https://blogs.msdn.com/scmorris/archive/2008/03/27/defining-columns-for-a-silverlight-datagrid.aspx" target="_blank">In XAML</a> </li>            <li><a href="https://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx" target="_blank">In Code Behind at Runtime</a> </li>         </ul>       </td>     </tr>      <tr valign="top">       <td><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 0px 0px; border-right-width: 0px" height="179" alt="TemplateColumn" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/TemplateColumn_99a53b6c-8bc3-46e3-a02a-c517f8d70884.jpg" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/Silverlight2DataGridisReleased_C8C4/TemplateColumn_99a53b6c-8bc3-46e3-a02a-c517f8d70884.jpg" width="129" border="0" /></td>        <td>         <h4>Template Column:</h4>          <p>In addition to the built-in column types, the template column gives you complete control of what to show during display and edit modes.</p>          <p>Read more about using the Template Column:</p>          <ul>           <li><a href="https://blogs.msdn.com/scmorris/archive/2008/03/27/defining-columns-for-a-silverlight-datagrid.aspx#template" target="_blank">In XAML</a> </li>            <li><a href="https://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#template" target="_blank">In Code Behind at Runtime</a> </li>         </ul>       </td>     </tr>   </tbody></table>]]></content:encoded>
    </item>
    <item>
      <title>Sorting Data in the Silverlight DataGrid</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/sorting-data-in-the-silverlight-datagrid</link>
      <pubDate>Tue, 10 Jun 2008 04:11:03 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/06/10/sorting-data-in-the-silverlight-datagrid/</guid>
      <description><![CDATA[This post has been updated to work with the RTW version of the Silverlight 2...]]></description>
      <content:encoded><![CDATA[<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#fff8c9" border="0"><tbody>     <tr>       <td valign="top">This post has been updated to work with the <a href="https://silverlight.net/GetStarted/" target="_blank">RTW version of the Silverlight 2 DataGrid</a>.&#160; The code examples are not guaranteed to work with previous Beta versions of the DataGrid. <a href="https://blogs.msdn.com/scmorris/archive/2008/10/14/silverlight-2-datagrid-is-released.aspx" target="_blank">Read more about the features that the Silverlight 2 DataGrid has to offer...</a></td>     </tr>   </tbody></table>  <h4>Multi-column Sorting</h4>  <p>One of the most requested features in Beta 1 was a way to sort the data contained in the DataGrid.&#160; In fact it was so desired that clever developers such as <a href="https://mattberseth.com/" target="_blank">Matt Berseth</a> simply <a href="https://mattberseth.com/blog/2008/03/sorting_with_silverlight_2s_da.html" target="_blank">created their own implementation</a>.&#160; Fortunately, you no longer have to put much work into getting this functionality out of the box.&#160; </p>  <p>To get sorting functionality in your DataGrid you will need to perform the following steps:</p>  <ol>   <li>Make sure that the collection that you use as the DataGrid's ItemsSource implements IList.&#160; Common implementations are List&lt;T&gt; and ObservableCollection&lt;T&gt;.&#160; </li>    <li>That's it, you don't need to do anything else </li> </ol>  <p>Why this odd requirement?&#160; Under the covers, when a DataGrid is data bound to a collection that implements IList, it creates an internal ListCollectionView to provide the sorting functionality.&#160; Since CollectionViews can handle multiple levels of sorting, the DataGrid also possesses this functionality and exposes it by allowing your users to click on multiple headers while holding the Shift key. </p>  <p>Here is the DataGrid showing off multi-column sorting:</p>  <p>&#160;<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="284" alt="MultiColumnSort" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/SortingDataintheSilverlightDataGrid_C2F5/MultiColumnSort_f6a82498-f6c9-4f56-b306-a3c8d83b60f9.png" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/SortingDataintheSilverlightDataGrid_C2F5/MultiColumnSort_f6a82498-f6c9-4f56-b306-a3c8d83b60f9.png" width="484" border="0" /> </p>  <h4>Customizing Sorting</h4>  <p>Alternatively if you want more control over how the sorting algorithm is performed, you can implement the ICollectionView interface currently found in System.Windows.Controls.Data.&#160; The DataGrid knows that when it is bound to an implementation of ICollectionView that it should delegate all sorting to it, listening to its SortDescriptions collection and visually displaying the sorting status of the CollectionView.&#160; Additionally by using an external CollectionView, you can have multiple controls share the same sort order.</p>  <h5>Turning Off Sorting</h5>  <p>It is easy to get sorting out of the box, but you might not want to allow your DataGrid or a particular column to be sorted by your user.&#160; To turn this off, use DataGrid's CanUserSortColumns property to turn on or off all sorting at the DataGrid level, or use DataGridColumn's CanUserSort to turn on or off sorting for a particular column.</p>  <p><a href="https://11011.net/software/vspaste"></a><strong>C#</strong></p>  <pre class="code">dataGrid1.CanUserSortColumns = <span style="color: blue">false</span>;</pre>

<pre class="code">unsortableColumn.CanUserSort = <span style="color: blue">false</span>;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>VB</strong></p>

<pre class="code">DataGrid1.CanUserSortColumns = <span style="color: blue">False</span></pre>

<pre class="code">UnsortableColumn.CanUserSort = <span style="color: blue">False</span></pre>

<h5>Choosing Which Property to Sort By</h5>

<p>Sometimes the property that your column is bound to is not always the one that you want it to sort by.&#160; Normally a column sorts by the property that it is bound to through the Binding property.&#160; However, if you look at the Template Column there is no Binding property, meaning that the DataGrid has no idea of how to sort the data if you were to click on that column's header.&#160; To give the DataGrid that information, you can use a property found on all column types called SortMemberPath.&#160; This property allows you to specify a path to the property on the data item that you want that particular column to sort by.&#160; Now if you create a template column that uses a DatePicker to allow your user to select a date instead of the standard TextBox, you can still provide sorting for that column by setting the SortMemberPath.</p>

<p><strong>C#</strong></p>

<pre class="code">datePickerColumn.SortMemberPath = <span style="color: #a31515">&quot;Birthday&quot;</span>;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>VB</strong></p>

<pre class="code">DatePickerColumn.SortMemberPath = <span style="color: #a31515">&quot;Birthday&quot;</span></pre>
<a href="https://11011.net/software/vspaste"></a>

<p>Notice that since SortMemberPath is on DataGridColumn, you can use this beyond just template columns and can actually have a column bound to one property, but sort based on another property.&#160; This is a much less common scenario, but becomes useful when working with types that normally don't support sorting such as Colors or Images.</p>

<p><strong>Sorting UI Cues</strong></p>

<p>In the picture above you can see that each sorted column has an arrow in its header indicating if it is sorted ascending or descending.&#160; It also has a subtle animation when switching between the two.&#160; If you want to customize how this looks or behaves, the easiest way to do this is to use the Visual State Manager in Blend.&#160; Otherwise, you can manually override the <a href="https://msdn.microsoft.com/library/cc278066(vs.95).aspx" target="_blank">default DataGridColumnHeader template</a> using the DataGrid.ColumnHeaderStyle property.&#160; The template contains two storyboards, one named &quot;SortAscending&quot; and the other named &quot;SortDescending&quot;.&#160; These two storyboards are ran by the DataGrid when a column is sorted ascending or descending.&#160; Finally there is a third storyboard called &quot;Unsorted&quot; that is ran when the data is no longer being sorted by that column and can be used to clean up any UI that you used to display sort status.</p>]]></content:encoded>
    </item>
    <item>
      <title>Auto-sizing the Silverlight DataGrid</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/auto-sizing-the-silverlight-datagrid</link>
      <pubDate>Tue, 10 Jun 2008 04:09:01 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/06/10/auto-sizing-the-silverlight-datagrid/</guid>
      <description><![CDATA[This post has been updated to work with the RTW version of the Silverlight 2...]]></description>
      <content:encoded><![CDATA[<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#fff8c9" border="0"><tbody>     <tr>       <td valign="top">This post has been updated to work with the <a href="https://silverlight.net/GetStarted/" target="_blank">RTW version of the Silverlight 2 DataGrid</a>.&#160; The code examples are not guaranteed to work with previous Beta versions of the DataGrid. <a href="https://blogs.msdn.com/scmorris/archive/2008/10/14/silverlight-2-datagrid-is-released.aspx" target="_blank">Read more about the features that the Silverlight 2 DataGrid has to offer...</a></td>     </tr>   </tbody></table>  <h4>Auto-sizing the DataGrid</h4>  <p>The Silverlight 2 DataGrid is auto-sized by default.&#160; This means that if you put it in a Canvas or a StackPanel and don't specify a Height or Width, or a MaxHeight or MaxWidth, you will get a DataGrid that is sized to its contents.&#160; </p>  <p><strong><em>Warning:</em> </strong>This can be dangerous however if you are working with a large (1000+ item) collection as the ItemsSource.&#160; Since the DataGrid will grow to the size of its contents, and will create objects for each cell that it can show based on its height, it will literally create thousands of objects to display all of the data.&#160; As you can guess this has app performance implications so you should avoid the combination of an auto-sized DataGrid and a large amount of data to display.&#160; This isn't an issue of course if you specify a Height or MaxHeight for the DataGrid, or put it in a container such as a Grid that provides it with a size.</p>  <p>Since the default size for the DataGrid is auto you won't have write any code to get auto-sizing behavior, but if you do give the DataGrid a height or width, and then want to switch it back to auto-size at runtime, simply set that value to double.NaN which is WPF and Silverlight's way of having a FrameworkElement auto-size itself.</p>  <p><strong>C#</strong></p>  <pre class="code">dataGrid1.Height = <span style="color: blue">double</span>.NaN;</pre>
<a href="https://11011.net/software/vspaste"></a>

<p><strong>VB</strong></p>

<pre class="code">DataGrid1.Height = <span style="color: blue">Double</span>.NaN</pre>
<a href="https://11011.net/software/vspaste"></a>

<h4>Auto-sizing Columns and Rows</h4>

<p>In addition to the DataGrid auto-sizing itself, Columns and Rows are also auto-sized by default.&#160; Like the DataGrid, rows are auto-sized in the same manner by setting the value to double.NaN while columns on the other hand are done slightly differetly.&#160; If you have ever worked with the Grid control, you might have noticed that the Width property of its ColumnDefinitions is not of type double, but rather a struct called GridLength.&#160; The reason for this is that unlike a FrameworkElement's Width or Height properties which only have the possible values of Auto or a numeric value, a ColumnDefinition's Width can be set to a numeric value, Auto, or Star.&#160; DataGridColumn.Width follows a similar pattern where instead of being of type double, it is of type DataGridLength.</p>

<p>The possible values for DataGridLenth are:</p>

<ul>
  <li><strong>Auto: </strong>This auto-sizes the column or row to grow to the size of the largest header <em>or </em>cell.&#160; It is effectively a combination of the other two auto-size modes.&#160; You might notice as you scroll when a new larger cell is encountered that this value increases.&#160; It will however not decrease once that item is scrolled out of view. </li>

  <li><strong>SizeToHeader: </strong>This auto-sizes the column or row the grow to the size of the header.&#160; This will ignore the contents of the cells when determining its size and will not change unless the size of the header changes. </li>

  <li><strong>SizeToCells: </strong>This auto-sizes the column or row to grow to the size of the largest visible cell.&#160; It will ignore the header cell in this calculation.&#160; You might notice as you scroll when a new larger cell is encountered that this value increases.&#160; It will however not decrease once that item is scrolled out of view. </li>

  <li><strong>Numeric: </strong>Unlike the others this is not an enum value, but rather simply a numeric value such as 100.&#160; This mode will behave the same way that Beta 1 did, however setting it in code behind is slightly different. </li>
</ul>

<p>Setting these in XAML is straight forward other than that unfortunately just like GridLength, there is no Intellisense for the enum values since a number is a valid entry as well.</p>

<p><strong>XAML</strong></p>

<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;dataGrid1&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;&gt;
    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid.Columns</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding</span><span style="color: blue">}&quot; 
            </span><span style="color: red"><strong>Width</strong></span><span style="color: blue"><strong>=&quot;Auto&quot;</strong> </span><span style="color: red">Header</span><span style="color: blue">=&quot;Auto&quot;/&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding</span><span style="color: blue">}&quot; 
            </span><span style="color: red"><strong>Width</strong></span><span style="color: blue"><strong>=&quot;SizeToHeader&quot;</strong> </span><span style="color: red">Header</span><span style="color: blue">=&quot;Size to Header&quot;/&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding</span><span style="color: blue">}&quot; 
            </span><span style="color: red"><strong>Width</strong></span><span style="color: blue"><strong>=&quot;SizeToCells&quot;</strong> </span><span style="color: red">Header</span><span style="color: blue">=&quot;Size to Cells&quot;/&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding</span><span style="color: blue">}&quot; 
           <strong> </strong></span><span style="color: red"><strong>Width</strong></span><span style="color: blue"><strong>=&quot;50&quot;</strong> </span><span style="color: red">Header</span><span style="color: blue">=&quot;Numeric&quot;/&gt;
    &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid.Columns</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid</span><span style="color: blue">&gt;</span></pre>

<p>If you were to run the code above and give it a data source it would look something like this:</p>

<p>&#160;<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="269" alt="AutoSizedColumns" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/scmorris/WindowsLiveWriter/AutosizingtheSilverlightDataGrid_C008/AutoSizedColumns_08c61a74-eede-45e3-9947-28fda55f5223.png" original-url="https://blogs.msdn.com/blogfiles/scmorris/WindowsLiveWriter/AutosizingtheSilverlightDataGrid_C008/AutoSizedColumns_08c61a74-eede-45e3-9947-28fda55f5223.png" width="384" border="0" /> </p>

<p>As you can see, once you know the possible enum values, setting it in XAML is fairly simple, and the Beta 1 code of Width=&quot;100&quot; just works.&#160; When you are working in code behind however things get slightly more tricky. </p>

<p>If you wanted to write code to do the same as above:</p>

<p><strong>C#</strong></p>

<pre class="code"><span style="color: #2b91af">DataGrid </span>dataGrid1 = <span style="color: blue">new </span><span style="color: #2b91af">DataGrid</span>();
dataGrid1.AutoGenerateColumns = <span style="color: blue">false</span>;

<span style="color: #2b91af">DataGridTextColumn </span>col1 = <span style="color: blue">new </span><span style="color: #2b91af">DataGridTextColumn</span>();
col1.Binding = <span style="color: blue">new </span><span style="color: #2b91af">Binding</span>();
<strong>col1.Width = <span style="color: #2b91af">DataGridLength</span>.Auto;
</strong>col1.Header = <span style="color: #a31515">&quot;Auto&quot;</span>;
dataGrid1.Columns.Add(col1);
<span style="color: #2b91af">DataGridTextColumn </span>col2 = <span style="color: blue">new </span><span style="color: #2b91af">DataGridTextColumn</span>();
col2.Binding = <span style="color: blue">new </span><span style="color: #2b91af">Binding</span>();
<strong>col2.Width = <span style="color: #2b91af">DataGridLength</span>.SizeToHeader;
</strong>col2.Header = <span style="color: #a31515">&quot;Size to Header&quot;</span>;
dataGrid1.Columns.Add(col2);
<span style="color: #2b91af">DataGridTextColumn </span>col3 = <span style="color: blue">new </span><span style="color: #2b91af">DataGridTextColumn</span>();
col3.Binding = <span style="color: blue">new </span><span style="color: #2b91af">Binding</span>();
<strong>col3.Width = <span style="color: #2b91af">DataGridLength</span>.SizeToCells;</strong>
col3.Header = <span style="color: #a31515">&quot;Size to Cells&quot;</span>;
dataGrid1.Columns.Add(col3);
<span style="color: #2b91af">DataGridTextColumn </span>col4 = <span style="color: blue">new </span><span style="color: #2b91af">DataGridTextColumn</span>();
col4.Binding = <span style="color: blue">new </span><span style="color: #2b91af">Binding</span>();
<strong>col4.Width = <span style="color: blue">new </span><span style="color: #2b91af">DataGridLength</span>(50);
</strong>col4.Header = <span style="color: #a31515">&quot;Numeric&quot;</span>;
dataGrid1.Columns.Add(col4);

dataGrid1.ItemsSource = <span style="color: #a31515">&quot;a b c d e f g h i j&quot;</span>.Split();
LayoutRoot.Children.Add(dataGrid1);</pre>

<p><strong>VB</strong></p>

<pre class="code"><span style="color: blue">Dim </span>dataGrid1 <span style="color: blue">As New </span>DataGrid
dataGrid1.AutoGenerateColumns = <span style="color: blue">False

Dim </span>col1 <span style="color: blue">As New </span>DataGridTextColumn
col1.Binding = <span style="color: blue">New </span>Binding
<strong>col1.Width = DataGridLength.Auto</strong>
col1.Header = <span style="color: #a31515">&quot;Auto&quot;
</span>dataGrid1.Columns.Add(col1)
<span style="color: blue">Dim </span>col2 <span style="color: blue">As New </span>DataGridTextColumn
col2.Binding = <span style="color: blue">New </span>Binding
<strong>col2.Width = DataGridLength.SizeToHeader
</strong>col2.Header = <span style="color: #a31515">&quot;Size to Header&quot;
</span>dataGrid1.Columns.Add(col2)
<span style="color: blue">Dim </span>col3 = <span style="color: blue">New </span>DataGridTextColumn
col3.Binding = <span style="color: blue">New </span>Binding
col3.Width = DataGridLength.SizeToCells
col3.Header = <span style="color: #a31515">&quot;Size to Cells&quot;
</span>dataGrid1.Columns.Add(col3)
<span style="color: blue">Dim </span>col4 = <span style="color: blue">New </span>DataGridTextColumn
col4.Binding = <span style="color: blue">New </span>Binding
<strong>col4.Width = <span style="color: blue">New </span>DataGridLength(50)
</strong>col4.Header = <span style="color: #a31515">&quot;Numeric&quot;
</span>dataGrid1.Columns.Add(col4)

dataGrid1.ItemsSource = <span style="color: #a31515">&quot;a b c d e f g h i j&quot;</span>.Split()
LayoutRoot.Children.Add(dataGrid1)</pre>

<p>The interesting line above is where the Numeric column's width is set to 50.&#160; There are two ways to do this.&#160; If you are working with doubles, you can create a new GridLength that takes a double in its constructor.&#160; This is the most common and the easiest way to do it.&#160; If however you are working with strings such as a value in a TextBox, you can use the ConvertFrom method on DataGridLengthConverter which takes an object and returns a GridLength.</p>]]></content:encoded>
    </item>
    <item>
      <title>What's New in the Silverlight DataGrid in Beta 2</title>
      <link>https://docs.microsoft.com/archive/blogs/scmorris/whats-new-in-the-silverlight-datagrid-in-beta-2</link>
      <pubDate>Tue, 10 Jun 2008 04:07:37 GMT</pubDate>
      <dc:creator><![CDATA[Scott_Morrison]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scmorris/2008/06/10/whats-new-in-the-silverlight-datagrid-in-beta-2/</guid>
      <description><![CDATA[Silverlight 2 Beta 2 was released this weekend, see what ScottGu has to say about it here.&#160;...]]></description>
      <content:encoded><![CDATA[<p><a href="https://silverlight.net/GetStarted/" target="_blank">Silverlight 2 Beta 2</a> was released this weekend, see what ScottGu has to say about it <a href="https://weblogs.asp.net/scottgu/archive/2008/06/06/silverlight-2-beta2-released.aspx" target="_blank">here</a>.&#160; We've all been pretty busy since releasing Beta 1 at MIX, and there are a lot of great new features across the product as a result.&#160; The question that you might be asking is what has changed in the DataGrid?&#160; Check out this list of new features and their associated posts to find out.</p>  <h4>New Features Overview</h4>  <ul>   <li><strong><a href="https://blogs.msdn.com/scmorris/archive/2008/06/10/auto-sizing-the-silverlight-datagrid.aspx" target="_blank">Auto-sizing:</a></strong> Unlike Beta 1 when you had to specify widths and heights yourself, everything in the DataGrid now can be auto-sized.&#160; That includes the DataGrid itself, Columns, Rows, Headers, and Row Details. </li>    <li><strong><a href="https://blogs.msdn.com/scmorris/archive/2008/06/10/sorting-data-in-the-silverlight-datagrid.aspx" target="_blank">Sorting:</a></strong> Now any time you bind the DataGrid to a collection that implements IList such as a List&lt;T&gt; you now get sorting for free.&#160; Even better sorting isn't limited to a single column, but end users can sort by multiple columns by holding Ctrl and clicking on additional column headers. </li>    <li><strong>Column Reordering:</strong> In Beta 1 the order of columns could be set programmatically, but now in Beta 2 we have extended this capability to the end user, where column reordering can be performed at runtime just by dragging a column's header. </li>    <li><strong>Frozen Columns: </strong>This is a semi-advanced feature, but once you know about it you'll be surprised at how useful it can be.&#160; A frozen column does not scroll horizontally but rather is &quot;frozen&quot; in place.&#160; This is the same as the Freeze Column feature in Excel. </li>    <li><strong>Programmatic Scrolling: </strong>Now you can scroll columns and items into view to make sure that an item you want to highlight to your user is visible on screen. </li>    <li><strong>Performance Enhancements:</strong> One of the big points of feedback we got in Beta 1 was vertical scrolling speed needed to be faster.&#160; We've made some improvements in this space to speed things up. </li>    <li><strong>API Improvements:</strong> These are changes that we made to existing API's to try to make using the DataGrid easier.&#160; Hopefully they are all for the better, and we would love to hear your feedback if you think that something could be easier. </li> </ul>]]></content:encoded>
    </item>
  </channel>
</rss>