<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How do I display grouped data in a TreeView?</title>
	<atom:link href="http://bea.stollnitz.com/blog/?feed=rss2&#038;p=18" rel="self" type="application/rss+xml" />
	<link>http://bea.stollnitz.com/blog/?p=18</link>
	<description>on Silverlight and WPF</description>
	<lastBuildDate>Mon, 02 Aug 2010 17:57:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-170256</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Fri, 20 Nov 2009 19:41:17 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-170256</guid>
		<description>Hi Rashish,

There is no way to prevent that behavior, other than expanding the TreeView again. You can read about expanding TreeView in the following 3 posts: &lt;a href=&quot;http://bea.stollnitz.com/blog/?p=54&quot; rel=&quot;nofollow&quot;&gt;part 1&lt;/a&gt;, &lt;a href=&quot;http://bea.stollnitz.com/blog/?p=55&quot; rel=&quot;nofollow&quot;&gt;part 2&lt;/a&gt;, &lt;a href=&quot;http://bea.stollnitz.com/blog/?p=59&quot; rel=&quot;nofollow&quot;&gt;part 3&lt;/a&gt;.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Rashish,</p>
<p>There is no way to prevent that behavior, other than expanding the TreeView again. You can read about expanding TreeView in the following 3 posts: <a href="http://bea.stollnitz.com/blog/?p=54" rel="nofollow">part 1</a>, <a href="http://bea.stollnitz.com/blog/?p=55" rel="nofollow">part 2</a>, <a href="http://bea.stollnitz.com/blog/?p=59" rel="nofollow">part 3</a>.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rashish Tandon</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-155011</link>
		<dc:creator>Rashish Tandon</dc:creator>
		<pubDate>Wed, 15 Jul 2009 02:45:09 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-155011</guid>
		<description>Hi Bea,

In relation to an earlier post, if a Property changes and we do cvs.View.Refresh(), it collapses the entire tree and we need to expand it to see the changes. Is there any way to prevent this ?</description>
		<content:encoded><![CDATA[<p>Hi Bea,</p>
<p>In relation to an earlier post, if a Property changes and we do cvs.View.Refresh(), it collapses the entire tree and we need to expand it to see the changes. Is there any way to prevent this ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-758</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Mon, 01 Oct 2007 19:24:51 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-758</guid>
		<description>Hi Alex,

Templating anonymously typed data works fine, as long as you give the template a key in the resources, and point the ItemTemplate to that key. Implicit templates (the ones that are applied by setting the DataType property) will not work in this scenario.

I created a simple sample of a ListBox bound to a collection of anonymous types, and used an explicit DataTemplate to template the data items. You can find it &lt;a href=&quot;http://www.beacosta.com/BlogComments/40AnonymousTypesTemplates.zip&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. You can do something similar for TreeView, by setting the ItemTemplate property of the TreeView, plus the ItemTemplate property of the HierarchicalDataTemplate.

Let me know if this helps.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>Templating anonymously typed data works fine, as long as you give the template a key in the resources, and point the ItemTemplate to that key. Implicit templates (the ones that are applied by setting the DataType property) will not work in this scenario.</p>
<p>I created a simple sample of a ListBox bound to a collection of anonymous types, and used an explicit DataTemplate to template the data items. You can find it <a href="http://www.beacosta.com/BlogComments/40AnonymousTypesTemplates.zip" rel="nofollow">here</a>. You can do something similar for TreeView, by setting the ItemTemplate property of the TreeView, plus the ItemTemplate property of the HierarchicalDataTemplate.</p>
<p>Let me know if this helps.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-718</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sun, 30 Sep 2007 23:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-718</guid>
		<description>Bea, 

Is there a way to use Hierarchical datatemplate on the treeview with anonymous types?
I want to bind treeview to a result of LINQ query without wrapping it in a concrete type.

Thanx, Alex</description>
		<content:encoded><![CDATA[<p>Bea, </p>
<p>Is there a way to use Hierarchical datatemplate on the treeview with anonymous types?<br />
I want to bind treeview to a result of LINQ query without wrapping it in a concrete type.</p>
<p>Thanx, Alex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-361</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Tue, 18 Sep 2007 17:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-361</guid>
		<description>Hi,

I updated this sample to work with Orcas Beta 2 bits. You can find the new project &lt;a href=&quot;http://www.beacosta.com/Zips/15GroupingTreeViewOrcasBeta2.zip&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.

Thanks,
Bea</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I updated this sample to work with Orcas Beta 2 bits. You can find the new project <a href="http://www.beacosta.com/Zips/15GroupingTreeViewOrcasBeta2.zip" rel="nofollow">here</a>.</p>
<p>Thanks,<br />
Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-270</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 02 Jul 2007 22:19:50 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-270</guid>
		<description>Could not get the example to build.</description>
		<content:encoded><![CDATA[<p>Could not get the example to build.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aeoth</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-269</link>
		<dc:creator>Aeoth</dc:creator>
		<pubDate>Fri, 25 Aug 2006 04:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-269</guid>
		<description>Bea, thanks! :D
That works perfectly</description>
		<content:encoded><![CDATA[<p>Bea, thanks! :D<br />
That works perfectly</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-267</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Thu, 24 Aug 2006 19:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-267</guid>
		<description>Hi Aeoth,

Currently, if you change the property you&#039;re grouping on, we don&#039;t refresh the groups automatically. You can refresh them yourself with the following code:

CollectionViewSource cvs = this.Resources[&quot;cvs&quot;] as CollectionViewSource;
cvs.View.Refresh();

We discussed the feature you&#039;re asking a long time ago, but decided to not add it in the first version of WPF because it&#039;s not trivial to design. For your particular scenario, since you&#039;re using PropertyGroupDescription to generate the groups, it would be easy for grouping code to listen to property changes on the property specified. However, if the user decides to use custom grouping, we would not be able to rely on INotifyPropertyChanged to get change notifications. We want to support this feature at some point, but that will require either only support non-custom grouping, or coming up with a new design that supports all kinds of groupings.

You can see a project with this blog sample working with property changes &lt;a href=&quot;http://www.beacosta.com/BlogComments/20GroupingTreeView2.zip&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.

Thanks,
Bea</description>
		<content:encoded><![CDATA[<p>Hi Aeoth,</p>
<p>Currently, if you change the property you&#8217;re grouping on, we don&#8217;t refresh the groups automatically. You can refresh them yourself with the following code:</p>
<p>CollectionViewSource cvs = this.Resources["cvs"] as CollectionViewSource;<br />
cvs.View.Refresh();</p>
<p>We discussed the feature you&#8217;re asking a long time ago, but decided to not add it in the first version of WPF because it&#8217;s not trivial to design. For your particular scenario, since you&#8217;re using PropertyGroupDescription to generate the groups, it would be easy for grouping code to listen to property changes on the property specified. However, if the user decides to use custom grouping, we would not be able to rely on INotifyPropertyChanged to get change notifications. We want to support this feature at some point, but that will require either only support non-custom grouping, or coming up with a new design that supports all kinds of groupings.</p>
<p>You can see a project with this blog sample working with property changes <a href="http://www.beacosta.com/BlogComments/20GroupingTreeView2.zip" rel="nofollow">here</a>.</p>
<p>Thanks,<br />
Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aeoth</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-266</link>
		<dc:creator>Aeoth</dc:creator>
		<pubDate>Wed, 23 Aug 2006 23:03:28 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-266</guid>
		<description>Hi Bea,
I&#039;ve got my Treeview setup - &quot;sorting&quot; based on the property.
What happens if say...&#039;evolution&#039; occurs, and a frog evolves into a bear group?

I&#039;m using INotifyPropertyChanged but it doesnt&#039; seem to &#039;move&#039; my frog over into the next group.</description>
		<content:encoded><![CDATA[<p>Hi Bea,<br />
I&#8217;ve got my Treeview setup &#8211; &#8220;sorting&#8221; based on the property.<br />
What happens if say&#8230;&#8217;evolution&#8217; occurs, and a frog evolves into a bear group?</p>
<p>I&#8217;m using INotifyPropertyChanged but it doesnt&#8217; seem to &#8216;move&#8217; my frog over into the next group.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=18&#038;cpage=1#comment-268</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Mon, 21 Aug 2006 20:49:30 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=18#comment-268</guid>
		<description>Hi Shanty,

You can add another level of grouping by adding a second PropertyGroupDescription to the GroupDescriptions collection of CollectionViewSource. Does this answer your question?

Thanks,
Bea</description>
		<content:encoded><![CDATA[<p>Hi Shanty,</p>
<p>You can add another level of grouping by adding a second PropertyGroupDescription to the GroupDescriptions collection of CollectionViewSource. Does this answer your question?</p>
<p>Thanks,<br />
Bea</p>
]]></content:encoded>
	</item>
</channel>
</rss>
