<?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: Thinking with MVVM: Data Templates + ContentControl</title>
	<atom:link href="http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/</link>
	<description>Jeremy Alles Presentation Foundation: WPF, .Net and modern software development</description>
	<lastBuildDate>Sat, 24 Jul 2010 08:59:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Paul</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-1769</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sat, 24 Jul 2010 08:59:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-1769</guid>
		<description>Thank you for this nice example of Configuration Dialog - it was really helpful but I have still one more question: how can I pass my DataContext from main config window (app settings) to ContentControl that every single SettingsView will be able to use it and bind it directly? For example I want to achieve something like this:


---- ConfigurationDialog.xaml
...
xmlns:properties=&quot;clr-namespace:ConfigurationDialogExample.Properties&quot;
...

    

    
        
    

...
...

...


---- GeneralSettingsView.xaml
...

...


MyNiceColor is of course one of base app settings from &quot;Properties.Settings.Default&quot;. The problem is that the ContentControl doesn&#039;t pass corectly new DataContext and as I have seen every child control from that ContentControl has only data from e.g. GeneralSettingsViewModel.cs that is the current ViewModel which is binded its &quot;Content&quot; property.

Although if I pass DataContext during creating a UserControl object (e.g.



) everything works fine, but it&#039;s  little bit not elegant solution I think, because I must repeat this for every UserControl (SettingsView) in ConfigurationWindow.

Any suggestions will be appreciated :)</description>
		<content:encoded><![CDATA[<p>Thank you for this nice example of Configuration Dialog &#8211; it was really helpful but I have still one more question: how can I pass my DataContext from main config window (app settings) to ContentControl that every single SettingsView will be able to use it and bind it directly? For example I want to achieve something like this:</p>
<p>&#8212;- ConfigurationDialog.xaml<br />
&#8230;<br />
xmlns:properties=&#8221;clr-namespace:ConfigurationDialogExample.Properties&#8221;<br />
&#8230;</p>
<p>&#8230;<br />
&#8230;</p>
<p>&#8230;</p>
<p>&#8212;- GeneralSettingsView.xaml<br />
&#8230;</p>
<p>&#8230;</p>
<p>MyNiceColor is of course one of base app settings from &#8220;Properties.Settings.Default&#8221;. The problem is that the ContentControl doesn&#8217;t pass corectly new DataContext and as I have seen every child control from that ContentControl has only data from e.g. GeneralSettingsViewModel.cs that is the current ViewModel which is binded its &#8220;Content&#8221; property.</p>
<p>Although if I pass DataContext during creating a UserControl object (e.g.</p>
<p>) everything works fine, but it&#8217;s  little bit not elegant solution I think, because I must repeat this for every UserControl (SettingsView) in ConfigurationWindow.</p>
<p>Any suggestions will be appreciated <img src='http://www.japf.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JAPF &#187; Blog Archive &#187; Review of 2009 blog posts</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-1626</link>
		<dc:creator>JAPF &#187; Blog Archive &#187; Review of 2009 blog posts</dc:creator>
		<pubDate>Mon, 12 Jul 2010 08:21:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-1626</guid>
		<description>[...] Thinking with MVVM: Data Templates + ContentControl [...]</description>
		<content:encoded><![CDATA[<p>[...] Thinking with MVVM: Data Templates + ContentControl [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bernd</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-1042</link>
		<dc:creator>bernd</dc:creator>
		<pubDate>Fri, 29 Jan 2010 20:37:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-1042</guid>
		<description>Hello Jeremy,

and what data/datatype is assigned to that SelectedItem property? I have 10 ViewModels, CustomerViewModel,ProductViewModel,... I can not make 10 SelectedItem properties in the MainViewModel. So what datatype has the return value of the SelectedItem property if I assign 10 different ViewModel instances...? You get me?

Help is really appreciated, like your blog although you could write more ;-)</description>
		<content:encoded><![CDATA[<p>Hello Jeremy,</p>
<p>and what data/datatype is assigned to that SelectedItem property? I have 10 ViewModels, CustomerViewModel,ProductViewModel,&#8230; I can not make 10 SelectedItem properties in the MainViewModel. So what datatype has the return value of the SelectedItem property if I assign 10 different ViewModel instances&#8230;? You get me?</p>
<p>Help is really appreciated, like your blog although you could write more <img src='http://www.japf.fr/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-1030</link>
		<dc:creator>Jeremy</dc:creator>
		<pubDate>Wed, 27 Jan 2010 11:57:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-1030</guid>
		<description>I think you could adapt the code by attaching a command to the Button. When this command gets executed, update a property that is databound to the ContentControl. In this case,you would create your own &quot;SelectedItem&quot; property since you don&#039;t have it if you&#039;re not using a ListBox. HTH</description>
		<content:encoded><![CDATA[<p>I think you could adapt the code by attaching a command to the Button. When this command gets executed, update a property that is databound to the ContentControl. In this case,you would create your own &#8220;SelectedItem&#8221; property since you don&#8217;t have it if you&#8217;re not using a ListBox. HTH</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bernd</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-1009</link>
		<dc:creator>bernd</dc:creator>
		<pubDate>Sat, 23 Jan 2010 21:37:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-1009</guid>
		<description>Hello Jeremy,

how would you your sample project work if you would use buttons in a stackpanel instead of a listbox? A button has no SelectedmItem property... so how would you use the button click? event to show the appropiate usercontrol in the contentcontrol?</description>
		<content:encoded><![CDATA[<p>Hello Jeremy,</p>
<p>how would you your sample project work if you would use buttons in a stackpanel instead of a listbox? A button has no SelectedmItem property&#8230; so how would you use the button click? event to show the appropiate usercontrol in the contentcontrol?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-311</link>
		<dc:creator>Jeremy</dc:creator>
		<pubDate>Wed, 13 May 2009 18:47:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-311</guid>
		<description>Thanks for the link I&#039;ll take a look :)</description>
		<content:encoded><![CDATA[<p>Thanks for the link I&#8217;ll take a look <img src='http://www.japf.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Per</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-310</link>
		<dc:creator>Michael Per</dc:creator>
		<pubDate>Wed, 13 May 2009 18:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-310</guid>
		<description>Jeremy,

Karl Shifflett suggested a solution for this with the slightly modified tab control that doesn&#039;t destroy the tabs. Tab control by Eric Burke:

http://eric.burke.name/dotnetmania/2009/04/26/22.09.28</description>
		<content:encoded><![CDATA[<p>Jeremy,</p>
<p>Karl Shifflett suggested a solution for this with the slightly modified tab control that doesn&#8217;t destroy the tabs. Tab control by Eric Burke:</p>
<p><a href="http://eric.burke.name/dotnetmania/2009/04/26/22.09.28" rel="nofollow">http://eric.burke.name/dotnetmania/2009/04/26/22.09.28</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-307</link>
		<dc:creator>Jeremy</dc:creator>
		<pubDate>Mon, 11 May 2009 10:53:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-307</guid>
		<description>Michael,

I&#039;ve been discussing this issue with Josh. Apparently, there is no simple workaround. Using DataTemplate-driven approach has its pros and cons... If your views are too expensive to throw them away and recreate them, you should try another approach (more &quot;classical&quot;).</description>
		<content:encoded><![CDATA[<p>Michael,</p>
<p>I&#8217;ve been discussing this issue with Josh. Apparently, there is no simple workaround. Using DataTemplate-driven approach has its pros and cons&#8230; If your views are too expensive to throw them away and recreate them, you should try another approach (more &#8220;classical&#8221;).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Per</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-306</link>
		<dc:creator>Michael Per</dc:creator>
		<pubDate>Thu, 07 May 2009 15:55:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-306</guid>
		<description>Jeremy,

I see that you are using a very similar approach to one described by Josh Smith in his MSDN article (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx). In your application (and in Josh&#039;s sample as well) the views are rendered as templates for view models. This is an elegant approach, but not without its drawbacks. 

One issue I have is that the view is recreated each time you switch between sections of your settings dialog (and each time you switch between tabs in Josh&#039;s example). If the view is not trivial it may take some time for the runtime to render it. You will also lose your UI state (if you&#039;ve scrolled down the list you&#039;ll be back at row 1).

I wonder if you have any ideas on how to make the views stay alive when switching between sections of your dialog?

Thanks,

Mike</description>
		<content:encoded><![CDATA[<p>Jeremy,</p>
<p>I see that you are using a very similar approach to one described by Josh Smith in his MSDN article (<a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/magazine/dd419663.aspx</a>). In your application (and in Josh&#8217;s sample as well) the views are rendered as templates for view models. This is an elegant approach, but not without its drawbacks. </p>
<p>One issue I have is that the view is recreated each time you switch between sections of your settings dialog (and each time you switch between tabs in Josh&#8217;s example). If the view is not trivial it may take some time for the runtime to render it. You will also lose your UI state (if you&#8217;ve scrolled down the list you&#8217;ll be back at row 1).</p>
<p>I wonder if you have any ideas on how to make the views stay alive when switching between sections of your dialog?</p>
<p>Thanks,</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arne Madsen</title>
		<link>http://www.japf.fr/2009/03/thinking-with-mvvm-data-templates-contentcontrol/comment-page-1/#comment-274</link>
		<dc:creator>Arne Madsen</dc:creator>
		<pubDate>Mon, 30 Mar 2009 10:27:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.japf.fr/?p=154#comment-274</guid>
		<description>Hi Jeremy,
A nice intro to MVVM - well done

Regards
Arne 
Denmark</description>
		<content:encoded><![CDATA[<p>Hi Jeremy,<br />
A nice intro to MVVM &#8211; well done</p>
<p>Regards<br />
Arne<br />
Denmark</p>
]]></content:encoded>
	</item>
</channel>
</rss>
