<?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: ItemsControl:  &#039;D&#039; is for DataTemplate</title>
	<atom:link href="http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/feed/" rel="self" type="application/rss+xml" />
	<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/</link>
	<description>Drinking (and serving) the WPF Kool-Aid since 2002</description>
	<lastBuildDate>Mon, 30 Aug 2010 18:54:01 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-233</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Thu, 19 Mar 2009 04:02:06 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-233</guid>
		<description>Hi Triage L3P,&lt;br&gt;&lt;br&gt;I&#039;m afraid I lost your comment (sorry), but I did get a chance to read it first...  You cannot simply cache the visuals in the scenario you describe, but you could certainly implement your own caching approach. In response to the SelectionChanged event, you can generate the content for the ContentControl and cache a hard reference to it in a collection. Then when selection changes again, you first check for cached content, and if present, reuse that content. Otherwise, generate and cache new content.&lt;br&gt;&lt;br&gt;Of course, since your code is maintaining hard references, you&#039;ll need some mechanism for releasing those so that your memory footprint doesn&#039;t skyrocket.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;-dw</description>
		<content:encoded><![CDATA[<p>Hi Triage L3P,</p>
<p>I&#8217;m afraid I lost your comment (sorry), but I did get a chance to read it first&#8230;  You cannot simply cache the visuals in the scenario you describe, but you could certainly implement your own caching approach. In response to the SelectionChanged event, you can generate the content for the ContentControl and cache a hard reference to it in a collection. Then when selection changes again, you first check for cached content, and if present, reuse that content. Otherwise, generate and cache new content.</p>
<p>Of course, since your code is maintaining hard references, you&#8217;ll need some mechanism for releasing those so that your memory footprint doesn&#8217;t skyrocket.</p>
<p>Cheers,<br />-dw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-232</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Fri, 05 Dec 2008 10:47:51 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-232</guid>
		<description>Hi ManamRajesh,&lt;br&gt;&lt;br&gt;Not sure who &quot;All&quot; is... but it sounds to me like you should be looking at Silverlight. WPF is for client applications. Silverlight is for web apps.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;-dw</description>
		<content:encoded><![CDATA[<p>Hi ManamRajesh,</p>
<p>Not sure who &#8220;All&#8221; is&#8230; but it sounds to me like you should be looking at Silverlight. WPF is for client applications. Silverlight is for web apps.</p>
<p>Cheers,<br />-dw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ManamRajesh</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-231</link>
		<dc:creator>ManamRajesh</dc:creator>
		<pubDate>Thu, 04 Dec 2008 00:13:40 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-231</guid>
		<description>Hi All,&lt;br&gt;&lt;br&gt;Does it possible to implement these technologies in ASP.NET web sites. means is it possible to provide the functionality - &quot; Data template selectors and to create a hierarchical listbox&quot; in .aspx pages.&lt;br&gt;&lt;br&gt;is this technology is only for windows desktop applications. please give some lights?&lt;br&gt;&lt;br&gt;Thanks</description>
		<content:encoded><![CDATA[<p>Hi All,</p>
<p>Does it possible to implement these technologies in ASP.NET web sites. means is it possible to provide the functionality &#8211; &#8221; Data template selectors and to create a hierarchical listbox&#8221; in .aspx pages.</p>
<p>is this technology is only for windows desktop applications. please give some lights?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-230</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Thu, 30 Oct 2008 10:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-230</guid>
		<description>Yes, Alex, that is a very common scenario and works fine. In fact, classes like TreeViewItem and MenuItem in WPF are exactly that... ItemsControls with nested ItemsControls.</description>
		<content:encoded><![CDATA[<p>Yes, Alex, that is a very common scenario and works fine. In fact, classes like TreeViewItem and MenuItem in WPF are exactly that&#8230; ItemsControls with nested ItemsControls.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-229</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 24 Oct 2008 13:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-229</guid>
		<description>Is it possible nest an ItemsControl inside another using a DataTemplate, the first one holding a whole family and the nested holding the family members?</description>
		<content:encoded><![CDATA[<p>Is it possible nest an ItemsControl inside another using a DataTemplate, the first one holding a whole family and the nested holding the family members?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-228</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Sun, 14 Sep 2008 10:59:42 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-228</guid>
		<description>&lt;div class=&quot;jbr&quot;&gt;Hi Vinnie,&lt;br&gt;&lt;br&gt;The table at the end of &lt;a href=&quot;http://drwpf.com/blog/?p=32&quot;&gt;I is for Item Container&lt;/a&gt; describes this behavior.  Namely, the ItemsControl class will perceive any UIElement as its own item container.  If you switch to a ListBox (or other descendant class), then your item template will be used.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;-dw&lt;/div&gt;</description>
		<content:encoded><![CDATA[<div class="jbr">Hi Vinnie,</p>
<p>The table at the end of <a href="http://drwpf.com/blog/?p=32">I is for Item Container</a> describes this behavior.  Namely, the ItemsControl class will perceive any UIElement as its own item container.  If you switch to a ListBox (or other descendant class), then your item template will be used.</p>
<p>Cheers,<br />-dw</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: VinnieP</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-227</link>
		<dc:creator>VinnieP</dc:creator>
		<pubDate>Sun, 14 Sep 2008 10:42:35 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-227</guid>
		<description>I&#039;ve noticed that DataTemplates seem to be ignored if the type of the Item is a Visual or UIElement (haven&#039;t determined where exactly it breaks down.)&#160; For example, in the following code, I get the template for the strings, but not for the Ellipses.&#160; Why is this?&lt;br&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ItemsControl&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ItemsControl.Items&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;sys:String&gt;Hello&lt;/sys:String&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;sys:String&gt;World&lt;/sys:String&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Ellipse Width=&quot;40&quot; Height=&quot;30&quot; Fill=&quot;Red&quot; /&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Ellipse Width=&quot;40&quot; Height=&quot;30&quot; Fill=&quot;Blue&quot; /&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/ItemsControl.Items&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ItemsControl.ItemTemplate&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;DataTemplate DataType=&quot;{x:Type Ellipse}&quot;&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;StackPanel&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;TextBlock Text=&quot;Template above&quot; /&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ContentPresenter Content=&quot;{Binding .}&quot; /&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;TextBlock Text=&quot;Template below&quot; /&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/StackPanel&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/DataTemplate&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/ItemsControl.ItemTemplate&gt;&lt;br&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/ItemsControl&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;ve noticed that DataTemplates seem to be ignored if the type of the Item is a Visual or UIElement (haven&#8217;t determined where exactly it breaks down.)&nbsp; For example, in the following code, I get the template for the strings, but not for the Ellipses.&nbsp; Why is this?</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ItemsControl&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ItemsControl.Items&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sys:String&gt;Hello&lt;/sys:String&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sys:String&gt;World&lt;/sys:String&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Ellipse Width=&quot;40&quot; Height=&quot;30&quot; Fill=&quot;Red&quot; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Ellipse Width=&quot;40&quot; Height=&quot;30&quot; Fill=&quot;Blue&quot; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ItemsControl.Items&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ItemsControl.ItemTemplate&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;DataTemplate DataType=&quot;{x:Type Ellipse}&quot;&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;StackPanel&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TextBlock Text=&quot;Template above&quot; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ContentPresenter Content=&quot;{Binding .}&quot; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TextBlock Text=&quot;Template below&quot; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/StackPanel&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/DataTemplate&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ItemsControl.ItemTemplate&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ItemsControl&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BladeWise</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-225</link>
		<dc:creator>BladeWise</dc:creator>
		<pubDate>Thu, 04 Sep 2008 01:26:59 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-225</guid>
		<description>Hello Dr.WPF,&lt;br&gt;even after reading all your posts, I still have a question about data templating and ItemsControl (shame on me!).&lt;br&gt;I know that a DataTemplate realization is always wrapped into a ContentPresenter, which is inside a specific container (depending on the type of ItemsControl). Now, is it possible, navigating the visual tree, to identify which ContentPresenter holds the DataTemplate realization?&lt;br&gt;&lt;br&gt;The question arises from a particular problem I&#039;m facing right now: I have created a Shape derived class used to plot functions; such elements can be used as typical UIElements, or can be used in a particular panel (derived from Canvas) which provides a sort of zooming feature; such feature is available for Plot objects that:&lt;br&gt;1. are direct children of the panel&lt;br&gt;2. are used as DataTemplate (within an ItemsControl)&lt;br&gt;Plots of the first kind can be identified easily, but I have some problems with Plot objects of type 2. At the moment I search the visual tree for the first occurrence of a ContentPresenter... assuming that the next visual element is the first element of the DataTemplate... unfortunally, I know that this approach can&#039;t work if the ItemContainer includes another ContentPresenter before the actual DataTemplate... &lt;br&gt;&lt;br&gt;Thanks for your patience reading this post,&lt;br&gt;Daniele</description>
		<content:encoded><![CDATA[<p>Hello Dr.WPF,<br />even after reading all your posts, I still have a question about data templating and ItemsControl (shame on me!).<br />I know that a DataTemplate realization is always wrapped into a ContentPresenter, which is inside a specific container (depending on the type of ItemsControl). Now, is it possible, navigating the visual tree, to identify which ContentPresenter holds the DataTemplate realization?</p>
<p>The question arises from a particular problem I&#8217;m facing right now: I have created a Shape derived class used to plot functions; such elements can be used as typical UIElements, or can be used in a particular panel (derived from Canvas) which provides a sort of zooming feature; such feature is available for Plot objects that:<br />1. are direct children of the panel<br />2. are used as DataTemplate (within an ItemsControl)<br />Plots of the first kind can be identified easily, but I have some problems with Plot objects of type 2. At the moment I search the visual tree for the first occurrence of a ContentPresenter&#8230; assuming that the next visual element is the first element of the DataTemplate&#8230; unfortunally, I know that this approach can&#8217;t work if the ItemContainer includes another ContentPresenter before the actual DataTemplate&#8230; </p>
<p>Thanks for your patience reading this post,<br />Daniele</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-226</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Thu, 04 Sep 2008 01:26:43 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-226</guid>
		<description>Hi Daniele,&lt;br&gt;&lt;br&gt;You can probably identify the correct ContentPresenter by looking at its Content property. If its the ContentPresenter for the item container, then its Content property will be equal to the data item itself.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;-dw</description>
		<content:encoded><![CDATA[<p>Hi Daniele,</p>
<p>You can probably identify the correct ContentPresenter by looking at its Content property. If its the ContentPresenter for the item container, then its Content property will be equal to the data item itself.</p>
<p>Cheers,<br />-dw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Felix</title>
		<link>http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/comment-page-1/#comment-224</link>
		<dc:creator>Felix</dc:creator>
		<pubDate>Tue, 15 Apr 2008 00:46:12 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=24#comment-224</guid>
		<description>Surely, it did help. Especially, after the reply led me to read the &#039;I&#039; part (that&#039;s why I waited couple of days for it to become clearer before replying). It seems that the visual root is a panel of some kind (I tested this with a ListBox and WrapPanel as ItemsPanel). I still don&#039;t know how it all works together (every step of the way) but rereading these articles and some other ones does illuminate the subject further. I will be on the lookout for the announced articles but no pressure!&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;Felix</description>
		<content:encoded><![CDATA[<p>Surely, it did help. Especially, after the reply led me to read the &#8216;I&#8217; part (that&#8217;s why I waited couple of days for it to become clearer before replying). It seems that the visual root is a panel of some kind (I tested this with a ListBox and WrapPanel as ItemsPanel). I still don&#8217;t know how it all works together (every step of the way) but rereading these articles and some other ones does illuminate the subject further. I will be on the lookout for the announced articles but no pressure!</p>
<p>Cheers,<br />Felix</p>
]]></content:encoded>
	</item>
</channel>
</rss>
