<?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>Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx</link><description>Model-View-ViewModel (MVVM) is one of those really interesting design patterns that are used in WPF. It provides a separation between the UI and business logic and uses data binding techniques to connect them together. Karl Shifflett has some great material</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Windows 7 News &amp;raquo; Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9360741</link><pubDate>Thu, 22 Jan 2009 03:46:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9360741</guid><dc:creator>Windows 7 News &amp;raquo; Exploring MVVM: Grouping with the DataGrid</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://windows7news.com.au/2009/01/22/exploring-mvvm-grouping-with-the-datagrid/"&gt;http://windows7news.com.au/2009/01/22/exploring-mvvm-grouping-with-the-datagrid/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9388535</link><pubDate>Sun, 01 Feb 2009 20:14:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9388535</guid><dc:creator>Thibaud</dc:creator><description>&lt;p&gt;Your article just give me an idea &lt;/p&gt;
&lt;p&gt;While {Binding} linking controls to data, my {MethodBinding} linking controls to a public method on Data entity&lt;/p&gt;
&lt;p&gt;see more here :&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://thibaud60.blogspot.com/2009/02/convert-clr-method-to-icommand-with.html"&gt;http://thibaud60.blogspot.com/2009/02/convert-clr-method-to-icommand-with.html&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Performance Issues</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9410898</link><pubDate>Tue, 10 Feb 2009 20:00:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9410898</guid><dc:creator>Alexander</dc:creator><description>&lt;p&gt;Dear Vincent,&lt;/p&gt;
&lt;p&gt;maybe you are not the right one to address for this issue, but maybe you could give me a hint. We use the WPF CTP Datagrid for a set of ~50 records (14 columns). Since the records increased from a few to the mentioned 50, in-cell editing became unbelievably slow, i.e. it takes seconds for the characters to appear after the key was pressed.&lt;/p&gt;
&lt;p&gt;The (well maybe not so) funny thing is that this occurs only on 64-bit, Windows Vista Home Premium HP TouchSmart with 4 GB of RAM and Intel DualCore CPU. The behaviour does not occur on slower 32bit-machines (we dont have an extra 64-bit machine to test). The WPF Visual Profiler shows that there is a lot of time spent for &amp;quot;Layout&amp;quot;. Whatever that means -- since it does not occur while editing on the 'not so good' machines. We do not hook onto any Datagrid-specific events, editing messages or whatsoever.&lt;/p&gt;
&lt;p&gt;Most remarkable to us was the fact that edit controls placed on a window which is child of the window containing the Datagrid show the same behaviour.&lt;/p&gt;
&lt;p&gt;Do you have any hint for us? &lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Alexander&lt;/p&gt;</description></item><item><title>re: Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9414982</link><pubDate>Thu, 12 Feb 2009 19:04:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9414982</guid><dc:creator>Alexander</dc:creator><description>&lt;p&gt;Hi, this is Alexander again.&lt;/p&gt;
&lt;p&gt;I solved the problem, but without knowing what the reason was. I found out that the problem did not occur when I removed the columns with the &amp;quot;IsReadOnly&amp;quot;-property set to &amp;quot;True&amp;quot;. To work around using this property, I used a DataGridTemplateColumn with a DataGrid.CellTemplate and a TexBlock in it, but without a DataGrid.CellEditingTemplate. That was it. Now my customer is happy again. But still, this behaviour seems pretty strange to me. &lt;/p&gt;
&lt;p&gt;For people facing the same problem, here is a small before/after-XAML-snippet:&lt;/p&gt;
&lt;p&gt;BEFORE (slow):&lt;/p&gt;
&lt;p&gt;==============&lt;/p&gt;
&lt;p&gt; &amp;lt;dg:DataGridTextColumn&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Header=&amp;quot;Test-Column&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;IsReadOnly=&amp;quot;True&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Binding=&amp;quot;{Binding Path=a_usual_read_only_property}&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;CanUserSort=&amp;quot;False&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;AFTER (as it should be):&lt;/p&gt;
&lt;p&gt;========================&lt;/p&gt;
&lt;p&gt;&amp;lt;dg:DataGridTemplateColumn Header=&amp;quot;Test-Column&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;dg:DataGridTemplateColumn.CellTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;lt;DataTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;TextBlock Text=&amp;quot;{Binding Path=a_usual_read_only_property}&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;lt;/DataTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/dg:DataGridTemplateColumn.CellTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/dg:DataGridTemplateColumn&amp;gt;&lt;/p&gt;</description></item><item><title>re: Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9890948</link><pubDate>Thu, 03 Sep 2009 18:46:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890948</guid><dc:creator>shafique</dc:creator><description>&lt;p&gt;I'm trying to set the Command binding from within a DataGridTemplateColumn, like so:&lt;/p&gt;
&lt;p&gt;&amp;lt;toolkit:DataGridTemplateColumn&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;toolkit:DataGridTemplateColumn.CellTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;DataTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBlock Text=&amp;quot;{Binding Path=LabelName}&amp;quot; Background=&amp;quot;{Binding Path=Color}&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;TextBlock.ContextMenu&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ContextMenu&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;MenuItem x:Name=&amp;quot;Assign&amp;quot; Header=&amp;quot;Assign&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mvvm:CommandBehavior.Event=&amp;quot;Click&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mvvm:CommandBehavior.Command=&amp;quot;{Binding Path=DataContext.EditLabelCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mvvm:CommandBehavior.CommandParameter=&amp;quot;{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}, Path=DataContext}&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ContextMenu&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/TextBlock.ContextMenu&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/TextBlock&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/DataTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/toolkit:DataGridTemplateColumn.CellTemplate&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/toolkit:DataGridTemplateColumn&amp;gt;&lt;/p&gt;
&lt;p&gt;but I can't find the binding source. Any ideas? I'm trying to hookup a EditCommand on my viewmodel, which is the datacontext for this usercontrol.&lt;/p&gt;</description></item><item><title>re: Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9892563</link><pubDate>Tue, 08 Sep 2009 16:38:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9892563</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;shafique,&lt;/p&gt;
&lt;p&gt;What does the binding error say, that it cannot find UserControl? &amp;nbsp;Have you tried specifying your specific implementation of the UserControl?&lt;/p&gt;
</description></item><item><title>re: Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9933951</link><pubDate>Tue, 08 Dec 2009 09:31:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9933951</guid><dc:creator>Frank</dc:creator><description>&lt;p&gt;Vincent&lt;/p&gt;
&lt;p&gt;in your example you put an IsExpanded property directly on each of the items.&lt;/p&gt;
&lt;p&gt;I have a similar problem, by which each item in the collection is styled depending on the actual data of the item. ( with many different style elements like typeface, color, size, IsExpanded ... ). I hesitate to clutter up the model with this type of data. &lt;/p&gt;
&lt;p&gt;I wonder if in the spirit of MVVM I should implement this with value converters or if it is not better to have the ItemSource bind to a collection of ItemViewModels which provides the style data and references the items data&lt;/p&gt;
&lt;p&gt;Frank&lt;/p&gt;</description></item><item><title>re: Exploring MVVM: Grouping with the DataGrid</title><link>http://blogs.msdn.com/vinsibal/archive/2009/01/21/exploring-mvvm-grouping-with-the-datagrid.aspx#9937011</link><pubDate>Tue, 15 Dec 2009 13:02:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937011</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Frank,&lt;/p&gt;
&lt;p&gt;Style data is really a View concept and while some properties make sense to bind to, not all of them should be bound to the ViewModel. &amp;nbsp;&lt;/p&gt;
</description></item></channel></rss>