<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx</link><description>This post has been updated to work with the RTW version of the Silverlight 2 DataGrid .&amp;#160; The code examples are not guaranteed to work with previous Beta versions of the DataGrid. Read more about the features that the Silverlight 2 DataGrid has to</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Microsoft news and tips &amp;raquo; Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8395590</link><pubDate>Tue, 15 Apr 2008 03:16:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8395590</guid><dc:creator>Microsoft news and tips &amp;raquo; Defining Silverlight DataGrid Columns at Runtime</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://microsoftnews.askpcdoc.com/?p=2411"&gt;http://microsoftnews.askpcdoc.com/?p=2411&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8396812</link><pubDate>Tue, 15 Apr 2008 09:59:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8396812</guid><dc:creator>Defining Silverlight DataGrid Columns at Runtime</dc:creator><description>&lt;p&gt;Now that you know the &amp;lt;a href=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://blogs.msd"&gt;http://blogs.msd&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>dynamic not working...</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8398800</link><pubDate>Wed, 16 Apr 2008 11:59:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8398800</guid><dc:creator>Rui Marinho</dc:creator><description>&lt;p&gt;Hi there Scott, i m m trying to create de datagrid dynam but it dosen't show anything.. here is my code:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; DataGrid dataGrid = new DataGrid();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.GridlinesVisibility = DataGridGridlines.Horizontal;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.HeadersVisibility = DataGridHeaders.Column;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.ColumnWidth=85;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.RowHeight=30;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (operacao == &amp;quot;bomb&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//criar colunas dinamicas&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DataGridTextBoxColumn textBoxColumn = new DataGridTextBoxColumn();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//criar header com sort&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HyperlinkButton hyperbut = new HyperlinkButton();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut.Content = &amp;quot;N&amp;#186; Int&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut.Tag = &amp;quot;nint&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut.Click += new RoutedEventHandler(Sort_Click);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut.TextDecorations = TextDecorations.Underline;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;textBoxColumn.Header = hyperbut;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;textBoxColumn.DisplayMemberBinding = new Binding(&amp;quot;nint&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.Columns.Add(textBoxColumn);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DataGridTextBoxColumn textBoxColumn1 = new DataGridTextBoxColumn();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//criar header com sort&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HyperlinkButton hyperbut1 = new HyperlinkButton();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut1.Content = &amp;quot;Nome&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut1.Tag = &amp;quot;nome&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut1.Click += new RoutedEventHandler(Sort_Click);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut1.TextDecorations = TextDecorations.Underline;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;textBoxColumn1.Header = hyperbut;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;textBoxColumn1.DisplayMemberBinding = new Binding(&amp;quot;nome&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.Columns.Add(textBoxColumn1);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DataGridTextBoxColumn textBoxColumn2 = new DataGridTextBoxColumn();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//criar header com sort&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HyperlinkButton hyperbut2 = new HyperlinkButton();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut2.Content = &amp;quot;Quadro&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut2.Tag = &amp;quot;quadro&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut2.Click += new RoutedEventHandler(Sort_Click);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hyperbut2.TextDecorations = TextDecorations.Underline;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;textBoxColumn2.Header = hyperbut;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;textBoxColumn2.DisplayMemberBinding = new Binding(&amp;quot;quadro&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dataGrid.Columns.Add(textBoxColumn2);&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8399159</link><pubDate>Wed, 16 Apr 2008 19:23:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8399159</guid><dc:creator>scmorris</dc:creator><description>&lt;p&gt;Hi Rui,&lt;/p&gt;
&lt;p&gt;There are two things that could be missing from your code:&lt;/p&gt;
&lt;p&gt;1) You are not setting the DataGrid's ItemsSource &lt;/p&gt;
&lt;p&gt;2) You are not adding the DataGrid to the visual tree&lt;/p&gt;
&lt;p&gt;I'll update the post to show how to add a DataGrid itself. &amp;nbsp;Let me know if you are doing both those things and still running into trouble.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Scott&lt;/p&gt;
</description></item><item><title>Silverlight Cream for April 16, 2008 - #252</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8399285</link><pubDate>Wed, 16 Apr 2008 20:59:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8399285</guid><dc:creator>Community Blogs</dc:creator><description>&lt;p&gt;Corey Gaudin on The Next Web, Matt Casto&amp;amp;#39;s Scrolling Textbox, Martin Mihaylov with an Image Control&lt;/p&gt;
</description></item><item><title>April 28th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8436582</link><pubDate>Tue, 29 Apr 2008 08:35:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8436582</guid><dc:creator>ScottGu's Blog</dc:creator><description>&lt;p&gt;Here is the latest in my link-listing series .&amp;amp;#160; Also check out my ASP.NET Tips, Tricks and Tutorials&lt;/p&gt;
</description></item><item><title>April 28th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8436603</link><pubDate>Tue, 29 Apr 2008 09:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8436603</guid><dc:creator>BusinessRx Reading List</dc:creator><description>&lt;p&gt;Here is the latest in my link-listing series .&amp;amp;#160; Also check out my ASP.NET Tips, Tricks and Tutorials&lt;/p&gt;
</description></item><item><title>April 28th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8436622</link><pubDate>Tue, 29 Apr 2008 09:21:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8436622</guid><dc:creator>Mirrored Blogs</dc:creator><description>&lt;p&gt;Here is the latest in my link-listing series .&amp;amp;#160; Also check out my ASP.NET Tips, Tricks and Tutorials&lt;/p&gt;
</description></item><item><title>4月28日链接篇： ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8440883</link><pubDate>Wed, 30 Apr 2008 06:04:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8440883</guid><dc:creator>Joycode@Ab110.com</dc:creator><description>&lt;p&gt;【原文地址】 April 28th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight 【原文发表日期】 Monday, April 28, 2008&lt;/p&gt;</description></item><item><title>28ste April links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight </title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8443359</link><pubDate>Wed, 30 Apr 2008 16:36:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8443359</guid><dc:creator>Scott Guthrie's Blog in Dutch</dc:creator><description>&lt;p&gt;Hier vind je mijn laatste link-lijst series . Bekijk ook mijn ASP.NET Tips, Tricks and Tutorials pagina&lt;/p&gt;
</description></item><item><title>Links do dia 28 de Abril: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8452232</link><pubDate>Sat, 03 May 2008 00:52:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8452232</guid><dc:creator>ScottGu's Blog em Português</dc:creator><description>&lt;p&gt;Aqui est&amp;#225; a &amp;#250;ltima vers&amp;#227;o da minha s&amp;#233;rie de listas de links . Verifique tamb&amp;#233;m minha p&amp;#225;gina de Dicas&lt;/p&gt;
</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8528005</link><pubDate>Wed, 21 May 2008 16:11:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8528005</guid><dc:creator>Jordy</dc:creator><description>&lt;p&gt;Is there a way to add a row in the datagrid? Something like this?&lt;/p&gt;
&lt;p&gt;targetDataGrid.Rows.Add(templateRow)&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8556217</link><pubDate>Wed, 28 May 2008 10:34:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8556217</guid><dc:creator>Jordy</dc:creator><description>&lt;p&gt;Is it also possible to add a DataRow in code behind?&lt;/p&gt;
&lt;p&gt;For the Colums you can use: dataGridName.Columns.Add(columnName);&lt;/p&gt;
&lt;p&gt;But there is no: dataGridName.Rows.Add(rowName); &amp;nbsp;You can define a datagridrow ( DataGridRow rowName = new DataGridRow() ), but than you can't add it to the dataGrid.&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8565309</link><pubDate>Sat, 31 May 2008 05:29:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8565309</guid><dc:creator>scmorris</dc:creator><description>&lt;p&gt;Hi Jordy,&lt;/p&gt;
&lt;p&gt;Unfortunately all of the rows in the Silverlight DataGrid need to have an equivalent item in the collection that it is bound to, and the &amp;quot;unbound&amp;quot; behavior that you are requesting is not supported currently in the DataGrid. &amp;nbsp;Depending on what you want to accomplish with the new rows there are a couple of paths you could take including adding proxies in your collection, or retemplating the DataGrid to have a row frozen at the bottom used for something like a totals row.&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;- Scott&lt;/p&gt;
</description></item><item><title>April 28th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, Silverlight</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8601189</link><pubDate>Sun, 15 Jun 2008 18:27:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8601189</guid><dc:creator>Readed By Wrocław NUG members</dc:creator><description>&lt;p&gt;Here is the latest in my link-listing series .&amp;amp;#160; Also check out my ASP.NET Tips, Tricks and Tutorials&lt;/p&gt;
</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8660634</link><pubDate>Fri, 27 Jun 2008 11:01:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8660634</guid><dc:creator>Alphatester001</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;with the xamlReader how do you add an event handler? - if you define it within the stringBuilder, the xamlReader throw an exception. I tried to define it through a style in a ResourceDictionary that I merge later on. If I look for style entry in the resourceDictionary it is there, same for the dataTemplate,but I get an error when the control get rendered. the error is : Cannot find resource named '{mystyle}'. Resource names are case sensitive. &amp;nbsp;Error at object 'System.Windows.Controls.ComboBox' . I double checked in the template I referred to mystyle and same &amp;nbsp;thing in my second dictionary.So error message is inappropriate. It is more an issue to locate the style in the dictionary... any clue?&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8743914</link><pubDate>Thu, 17 Jul 2008 17:03:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8743914</guid><dc:creator>rtr0mdrn</dc:creator><description>&lt;p&gt;Scott, I would like to know how to add a column dynamically after all autogenerated columns have been created. &amp;nbsp;In other words I would like for the grid to generate columns using the binding context, and after this has completed insert a more static or functional column (such as a button) which can be used to interact with the bound data or add additional features. &amp;nbsp;I see the autogenerating column event but there does not appear to be any eventing related to binding having completed or all column generation completed. &amp;nbsp;Is it possible to mix autogeneration with static column insertion and if so how best to do this at runtime? &amp;nbsp;Thanks.&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8745759</link><pubDate>Fri, 18 Jul 2008 04:54:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8745759</guid><dc:creator>johnzabroski</dc:creator><description>&lt;p&gt;Is it okay to specify a ConverterParameter using XML literals in the C# code behind? &amp;nbsp;I basically copied your XML literal example verbatim, but added a ConverterParameter and instead of the source value being a property, it was a whole collection with the ConverterParameter used as a key to pick an item in the collection. &amp;nbsp;Sort of like LINQifying David Anson's IValueConverter SwissArmyKnife PropertyViewer.&lt;/p&gt;
</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8750694</link><pubDate>Fri, 18 Jul 2008 21:31:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8750694</guid><dc:creator>johnzabroski</dc:creator><description>&lt;p&gt;Scott,&lt;/p&gt;
&lt;p&gt;I am not sure your code here is 100% correct. &amp;nbsp;You show how to dynamically construct XAML using a CLR StringBuilder and then pass that into XamlReader.Load(string). &amp;nbsp;Do XML fragments have to be fully-qualified using &amp;lt;?Mapping XmlNamespace=&amp;quot;blah&amp;quot; ClrNamespace=&amp;quot;clr-blah-app&amp;quot; Assembly=&amp;quot;blah-assembly&amp;quot; ?&amp;gt; ?&lt;/p&gt;
&lt;p&gt;I keep getting ManagedRuntime 4004 exceptions when I try to use your approach above.&lt;/p&gt;
</description></item><item><title>Silverlight 文章收集</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8762972</link><pubDate>Tue, 22 Jul 2008 05:36:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762972</guid><dc:creator>木野狐(Neil Chen)</dc:creator><description>&lt;p&gt;(以下内容全部整理自博客堂Scottgu博客中文版)Silverlight技巧，诀窍，教程和链接 【原文地址】SilverlightTips,Tricks,...&lt;/p&gt;
</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8957039</link><pubDate>Thu, 18 Sep 2008 12:45:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8957039</guid><dc:creator>SLNewb</dc:creator><description>&lt;p&gt;The columns part of this is real handy. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;For the resources method, it would be helpful to me for the example to include the following: &lt;/p&gt;
&lt;p&gt;- reference necessary for dateconverter (or class def), can't seem to find this in my project. &lt;/p&gt;
&lt;p&gt;- xmlns definition required&lt;/p&gt;
&lt;p&gt;- example of locating this resource template outside the control.xaml (which seems to be the most likely usage, yes?)&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#8971199</link><pubDate>Wed, 01 Oct 2008 09:39:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8971199</guid><dc:creator>oneone</dc:creator><description>&lt;p&gt;is possible to add a listbox ?&lt;/p&gt;</description></item><item><title>Silverlight 2 DataGrid is Released</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9000396</link><pubDate>Wed, 15 Oct 2008 09:46:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000396</guid><dc:creator>Scott Morrison</dc:creator><description>&lt;p&gt;As you might have heard , we just released Silverlight 2 , and with it the first version of the Silverlight&lt;/p&gt;
</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9003742</link><pubDate>Sat, 18 Oct 2008 00:37:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9003742</guid><dc:creator>Ronnie Meijer</dc:creator><description>&lt;p&gt;I have a simple datagrid and I want to align one column to the right.&lt;/p&gt;
&lt;p&gt;Is there a way to do this dynamically.&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9039091</link><pubDate>Tue, 04 Nov 2008 15:34:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9039091</guid><dc:creator>marjolein</dc:creator><description>&lt;p&gt;How can I bind a two-dimensional object? So I don't know in advance how many columns there are. Each columns contains a set of values. The itemSource of my datagrid is the collection of columns, but what is then the binding of my value in the columns?&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Column1 &amp;nbsp;Column2 ...&lt;/p&gt;
&lt;p&gt;Item 1 &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6&lt;/p&gt;
&lt;p&gt;Item 2 &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8&lt;/p&gt;
&lt;p&gt;Item 3 &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;</description></item><item><title>WPF Datagrid with DataGridColumn</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9169072</link><pubDate>Wed, 03 Dec 2008 11:59:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9169072</guid><dc:creator>Hema</dc:creator><description>&lt;p&gt;To display a cell having multiple columns at runtime i would like to have a datagridcolumn on cell click or a datagridcomboboxcolumn which can display multiple columns at runtime&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9437863</link><pubDate>Sat, 21 Feb 2009 21:39:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9437863</guid><dc:creator>Andrus</dc:creator><description>&lt;p&gt;How to add event handler using XamlReader.Load method ?&lt;/p&gt;
&lt;p&gt;Code below causes exception AG_E_PARSER_BAD_PROPERTY_VALUE&lt;/p&gt;
&lt;p&gt;I tried to move AddToCart_Click method to Page class but problem persists.&lt;/p&gt;
&lt;p&gt;Or is it possible to set click event handler in code ?&lt;/p&gt;
&lt;p&gt;Andrus.&lt;/p&gt;
&lt;p&gt;Page.xaml:&lt;/p&gt;
&lt;p&gt;&amp;lt;UserControl xmlns:data=&amp;quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&amp;quot; &amp;nbsp;x:Class=&amp;quot;DataGridDynamicColClickHandler.Page&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;xmlns=&amp;quot;&lt;a rel="nofollow" target="_new"&gt;&lt;a rel="nofollow" target="_new"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;/presentation"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;/presentation&lt;/a&gt;&amp;quot;"&gt;&lt;a rel="nofollow" target="_new"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;/presentation"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;/presentation&lt;/a&gt;&amp;quot;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;xmlns:x=&amp;quot;&lt;a rel="nofollow" target="_new"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;&amp;quot;"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;&amp;quot;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; 	xmlns:myGrid=&amp;quot;clr-namespace:DataGridDynamicColClickHandler&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Grid x:Name=&amp;quot;LayoutRoot&amp;quot; Background=&amp;quot;White&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;myGrid:DataGridBase x:Name=&amp;quot;InventoryList&amp;quot;&amp;gt;&amp;lt;/myGrid:DataGridBase &amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/Grid&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/UserControl&amp;gt;&lt;/p&gt;
&lt;p&gt;Page.xaml.cs:&lt;/p&gt;
&lt;p&gt;using System.Windows;&lt;/p&gt;
&lt;p&gt;using System.Windows.Controls;&lt;/p&gt;
&lt;p&gt;using System.Windows.Markup;&lt;/p&gt;
&lt;p&gt;namespace DataGridDynamicColClickHandler&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public partial class Page : UserControl&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public Page()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InitializeComponent();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InventoryList.Create();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public class Product&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public string Name { get; set; }&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public class DataGridBase : DataGrid&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void Create()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ItemsSource = new Product[] { new Product { Name = &amp;quot;Apple&amp;quot; }};&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DataGridTemplateColumn xtemplateColumn = new DataGridTemplateColumn();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xtemplateColumn.CellTemplate = XamlReader.Load(string.Format(@&amp;quot;&amp;lt;DataTemplate &lt;/p&gt;
&lt;p&gt;xmlns='&lt;a rel="nofollow" target="_new"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;/presentation"&gt;&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;/presentation&lt;/a&gt;' &lt;/p&gt;
&lt;p&gt;xmlns:x='&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;'&lt;/p&gt;
&lt;p&gt;xmlns:myGrid=&amp;quot;&amp;quot;clr-namespace:DataGridDynamicColClickHandler&amp;quot;&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;Button Click=&amp;quot;&amp;quot;AddToCart_Click&amp;quot;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/DataTemplate&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;)) as DataTemplate;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Columns.Add(xtemplateColumn);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void AddToCart_Click(object sender, RoutedEventArgs e)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9463433</link><pubDate>Fri, 06 Mar 2009 23:55:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9463433</guid><dc:creator>Jason Young</dc:creator><description>&lt;p&gt;Hi Scott, any idea how I can get a frozen column on the right hand side of the grid?&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime Error on Blend!!!!! </title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9469716</link><pubDate>Wed, 11 Mar 2009 00:43:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9469716</guid><dc:creator>Beto</dc:creator><description>&lt;p&gt;Hi, when i use the below XAML to create the DataTemplates as resources to support the code for this method.&lt;/p&gt;
&lt;p&gt;&amp;lt;UserControl.Resources&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;local:DateTimeConverter x:Key=&amp;quot;DateConverter&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;DataTemplate x:Key=&amp;quot;myCellTemplate&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBlock &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Text=&amp;quot;{Binding Birthday, &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Converter={StaticResource DateConverter}}&amp;quot; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Margin=&amp;quot;4&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/DataTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt;Blend close in same time !!!!!&lt;/p&gt;
&lt;p&gt;just paste de follow xaml : &amp;nbsp; &lt;/p&gt;
&lt;p&gt;Converter={StaticResource DateConverter}}&amp;quot; &lt;/p&gt;
&lt;p&gt;Makes the Blend close , a messageBox show a internal error . please help!!! &lt;/p&gt;
&lt;p&gt;sorry my bad inglish!&lt;/p&gt;
&lt;p&gt;Thanks &lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9470712</link><pubDate>Wed, 11 Mar 2009 19:27:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470712</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Has anyone added a summary /totals to a templated data grid (other than devexpress) ... or to a plain grid? &amp;nbsp; &lt;/p&gt;
&lt;p&gt;Did you use grid/cell events to trigger recalculation once changes were made to the underlying observable collection?&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9507918</link><pubDate>Wed, 25 Mar 2009 20:38:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9507918</guid><dc:creator>Rick Kierner</dc:creator><description>&lt;p&gt;Good post. &amp;nbsp;Very helpful. &amp;nbsp;It's working for me the way you've explained it. &amp;nbsp;I'm creating dynamic data columns just fine. &amp;nbsp;My problem is when I want to handle the click event or text changed event of one of my columns. &amp;nbsp;If I use a static column template, the event will fire. &amp;nbsp;If I use a dynamic template, I get a parse error identifying the Click=&amp;quot;MyClickEventHandler&amp;quot; section of code. &amp;nbsp;Ideas?&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9535226</link><pubDate>Tue, 07 Apr 2009 08:09:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9535226</guid><dc:creator>Tony</dc:creator><description>&lt;p&gt;Hi Scott;&lt;/p&gt;
&lt;p&gt;How can some access control in datagrid ?&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9763478</link><pubDate>Wed, 17 Jun 2009 03:49:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9763478</guid><dc:creator>Servando</dc:creator><description>&lt;p&gt;I'm using Silverlight 2.0 and trying the XamlReader Method.&lt;/p&gt;
&lt;p&gt;I'm doing a basic sample with just one column, added stackpanel to the page and a datagrid with name TestGrid to the panel.&lt;/p&gt;
&lt;p&gt;My project's name is DBGridTest, the class' name is the default (Page).&lt;/p&gt;
&lt;p&gt;I changed your code and instead of YourNamespace putted &amp;quot;DBGridTest&amp;quot; which is the namespace for my project &lt;/p&gt;
&lt;p&gt;and instead of YourAssembly putted &amp;quot;DBGridTest.Page&amp;quot;.&lt;/p&gt;
&lt;p&gt;I have a class with Birthday property of DateTime type, just that property for now.&lt;/p&gt;
&lt;p&gt;I create a generic List of theis class and add 5 elements to it.&lt;/p&gt;
&lt;p&gt;Then in the Page constructor after InitializeComponent() y put the following:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TestGrid.Columns.Add(templateColumn);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TestGrid.AutoGenerateColumns = false;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TestGrid.ItemsSource = employeelist;&lt;/p&gt;
&lt;p&gt;When I set the Datagrid height small so that only the headers are shown it runs ok. &lt;/p&gt;
&lt;p&gt;But if I change the height so that the column's content will would be shown the iexplore.exe throws and exception 5828.&lt;/p&gt;
&lt;p&gt;when instead of adding the columns I set AutoGenerateColumns = true; it all runs ok.&lt;/p&gt;
&lt;p&gt;Am I missing a property on the DataGrid or something else?&lt;/p&gt;</description></item><item><title>re: Defining Silverlight DataGrid Columns at Runtime</title><link>http://blogs.msdn.com/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx#9840331</link><pubDate>Sun, 19 Jul 2009 22:18:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9840331</guid><dc:creator>Kamran</dc:creator><description>&lt;p&gt;Thanks for the great post. I've referred to it several times :)&lt;/p&gt;</description></item></channel></rss>