<?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: Better User and Developer Experiences &#8211; From Windows Forms to WPF with MVVM: Part 7, MVVM</title>
	<atom:link href="http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/feed/" rel="self" type="application/rss+xml" />
	<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/</link>
	<description>Thoughts on C#, WPF, .NET, and programming for Scientific Visualization</description>
	<lastBuildDate>Sat, 04 Sep 2010 01:57:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: zamesking</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-786</link>
		<dc:creator>zamesking</dc:creator>
		<pubDate>Sun, 28 Feb 2010 01:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-786</guid>
		<description>Reed,

Thanks for the reply, but I can not open the link in my country. Would you please copy the text, and send it to my mail box?</description>
		<content:encoded><![CDATA[<p>Reed,</p>
<p>Thanks for the reply, but I can not open the link in my country. Would you please copy the text, and send it to my mail box?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: <img src='http://reedcopsey.com/blog/wp-content/plugins/rpx/images/openid.png'/> Reed</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-780</link>
		<dc:creator><img src='http://reedcopsey.com/blog/wp-content/plugins/rpx/images/openid.png'/> Reed</dc:creator>
		<pubDate>Sat, 27 Feb 2010 20:23:41 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-780</guid>
		<description>zamesking,

Here&#039;s an article describing one approach.  Using SelectedItems is tricky, though.

http://bit.ly/alNF72

-Reed</description>
		<content:encoded><![CDATA[<p>zamesking,</p>
<p>Here&#8217;s an article describing one approach.  Using SelectedItems is tricky, though.</p>
<p><a href="http://bit.ly/alNF72" rel="nofollow">http://bit.ly/alNF72</a></p>
<p>-Reed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zamesking</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-775</link>
		<dc:creator>zamesking</dc:creator>
		<pubDate>Sat, 27 Feb 2010 02:45:15 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-775</guid>
		<description>Great stuff, I got time to read your mvvm articles after my vocation. reed, I got a problem at hand now, I can not find an elegant solution for how to two-way bind the selectedItems in ListBox to the datasource in my viewmodel. Did you have any suggestions?</description>
		<content:encoded><![CDATA[<p>Great stuff, I got time to read your mvvm articles after my vocation. reed, I got a problem at hand now, I can not find an elegant solution for how to two-way bind the selectedItems in ListBox to the datasource in my viewmodel. Did you have any suggestions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Better User and Developer Experiences &#8211; From Windows Forms to WPF with MVVM: Conclusion : Reed Copsey, Jr.</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-480</link>
		<dc:creator>Better User and Developer Experiences &#8211; From Windows Forms to WPF with MVVM: Conclusion : Reed Copsey, Jr.</dc:creator>
		<pubDate>Thu, 07 Jan 2010 22:17:07 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-480</guid>
		<description>[...] Windows Presentation Foundation provides us with new opportunities to build applications that are very flexible to design, easy to maintain, and clear to understand.&#160; By taking advantage of Data Binding, Commands, and Templating, we can rethink the way we build our applications, and design them using the Model-View-ViewModel Pattern. [...]</description>
		<content:encoded><![CDATA[<p>[...] Windows Presentation Foundation provides us with new opportunities to build applications that are very flexible to design, easy to maintain, and clear to understand.&#160; By taking advantage of Data Binding, Commands, and Templating, we can rethink the way we build our applications, and design them using the Model-View-ViewModel Pattern. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-478</link>
		<dc:creator>Robert</dc:creator>
		<pubDate>Thu, 07 Jan 2010 18:06:12 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-478</guid>
		<description>Thanks Reed, this has been an outstanding series of articles on a subject I find quite fascinating. I&#039;ll be following along for more.</description>
		<content:encoded><![CDATA[<p>Thanks Reed, this has been an outstanding series of articles on a subject I find quite fascinating. I&#8217;ll be following along for more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: <img src='http://reedcopsey.com/blog/wp-content/plugins/rpx/images/openid.png'/> Reed</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-477</link>
		<dc:creator><img src='http://reedcopsey.com/blog/wp-content/plugins/rpx/images/openid.png'/> Reed</dc:creator>
		<pubDate>Thu, 07 Jan 2010 17:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-477</guid>
		<description>Pete,

Very good point re: Silverlight vs. WPF.  I definitely see how the limitations in Silverlight, especially prior to SL 4, would make it so having View related code is &quot;less bad&quot; than the alternative hoops you&#039;d have to jump through to avoid it.  

Mostly, my goal here was to get people coming from Windows Forms (ie: writing desktop apps) to think differently, so I&#039;m really focused on WPF over Silverlight.  I&#039;m trying to explain the why behind the pattern, as well as what specifically makes it work in WPF.  It&#039;s something I feel has been lacking in all of the (very excellent) MVVM articles I&#039;ve read to date...  For a Windows Forms developer, putting code in the code behind is natural - trying to break that habit is probably the most important hurdle to jump through in moving to WPF, in my opinion.

Thanks for the feedback!  I really appreciate it.

-Reed</description>
		<content:encoded><![CDATA[<p>Pete,</p>
<p>Very good point re: Silverlight vs. WPF.  I definitely see how the limitations in Silverlight, especially prior to SL 4, would make it so having View related code is &#8220;less bad&#8221; than the alternative hoops you&#8217;d have to jump through to avoid it.  </p>
<p>Mostly, my goal here was to get people coming from Windows Forms (ie: writing desktop apps) to think differently, so I&#8217;m really focused on WPF over Silverlight.  I&#8217;m trying to explain the why behind the pattern, as well as what specifically makes it work in WPF.  It&#8217;s something I feel has been lacking in all of the (very excellent) MVVM articles I&#8217;ve read to date&#8230;  For a Windows Forms developer, putting code in the code behind is natural &#8211; trying to break that habit is probably the most important hurdle to jump through in moving to WPF, in my opinion.</p>
<p>Thanks for the feedback!  I really appreciate it.</p>
<p>-Reed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-476</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Thu, 07 Jan 2010 17:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-476</guid>
		<description>Thanks Reed. I appreciate the clarification. 

I love this series, BTW.

On file dialog: One test I have mentally for what belongs in a viewmodel is &quot;if I changed view technology, would it still apply&quot;. I agree that a services is probably a better approach there.

Many Silverlight folks look to WPF thought leaders for information on patterns like MVVM. Until very recently, they had to do things differently due to limitations in the platform. Often times, that meant some small amount of wire-up code in the code-behind. I agree that in WPF it&#039;s harder to justify since the platform is more complete.

Pete</description>
		<content:encoded><![CDATA[<p>Thanks Reed. I appreciate the clarification. </p>
<p>I love this series, BTW.</p>
<p>On file dialog: One test I have mentally for what belongs in a viewmodel is &#8220;if I changed view technology, would it still apply&#8221;. I agree that a services is probably a better approach there.</p>
<p>Many Silverlight folks look to WPF thought leaders for information on patterns like MVVM. Until very recently, they had to do things differently due to limitations in the platform. Often times, that meant some small amount of wire-up code in the code-behind. I agree that in WPF it&#8217;s harder to justify since the platform is more complete.</p>
<p>Pete</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: <img src='http://reedcopsey.com/blog/wp-content/plugins/rpx/images/openid.png'/> Reed</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-475</link>
		<dc:creator><img src='http://reedcopsey.com/blog/wp-content/plugins/rpx/images/openid.png'/> Reed</dc:creator>
		<pubDate>Thu, 07 Jan 2010 16:46:37 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-475</guid>
		<description>Pete,

First off, I was suggesting that the goal should be to have zero code in the code behind - not necessarily that it is an absolute, hard rule.

That being said, I do agree that there are times when it&#039;s reasonable to have code in the code-behind.  However, in my experience to date, I&#039;ve yet to find a single instance where there wasn&#039;t a more elegant approach.  Typically, I&#039;ve found that, when I need code in the code behind file, it&#039;s nearly always handled more elegantly, and more reusably, by creating an attached property or (Expression Blend SDK-based) Behavior, or by using some form of dependency injection/service (I use MEF for this) to handle the creation from within the ViewModel.

Personally, I think displaying a FileDialog is a function of the ViewModel - not because of the dialog (which I agree is View, but could easily be provided via a service), but because the processing of a file dialog is logic that needs to be tested, and having that as part of a command or a method in the ViewModel makes testing much simpler.

Anyways, thank you very much for your comments!

-Reed</description>
		<content:encoded><![CDATA[<p>Pete,</p>
<p>First off, I was suggesting that the goal should be to have zero code in the code behind &#8211; not necessarily that it is an absolute, hard rule.</p>
<p>That being said, I do agree that there are times when it&#8217;s reasonable to have code in the code-behind.  However, in my experience to date, I&#8217;ve yet to find a single instance where there wasn&#8217;t a more elegant approach.  Typically, I&#8217;ve found that, when I need code in the code behind file, it&#8217;s nearly always handled more elegantly, and more reusably, by creating an attached property or (Expression Blend SDK-based) Behavior, or by using some form of dependency injection/service (I use MEF for this) to handle the creation from within the ViewModel.</p>
<p>Personally, I think displaying a FileDialog is a function of the ViewModel &#8211; not because of the dialog (which I agree is View, but could easily be provided via a service), but because the processing of a file dialog is logic that needs to be tested, and having that as part of a command or a method in the ViewModel makes testing much simpler.</p>
<p>Anyways, thank you very much for your comments!</p>
<p>-Reed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-474</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Thu, 07 Jan 2010 06:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-474</guid>
		<description>When I first scanned this,what stood out to me was this bold quote:

&quot;The user interface should be declared entirely in XAML, with zero code behind.&quot;

While I agree that one should keep most logic out of the code-behind, I disagree that there should be zero code there.

View-specific code is ok to have there. That is, code that exists solely to perform a view function, such as building an animation or something, or setting up a relationship between two elements in a view when perhaps that is cumbersome to do in xaml, can be in the view. 

Putting something into a specific visual state in response to a message from the VM is, perhaps, another case. Typically (99%) you&#039;d handle that with binding, but that&#039;s not always a reasonable route to take.

Other view code could be for things like displaying a file dialog. Displaying a file dialog is really a view function. Dealing with the results of the dialog should happen elsewhere. If not displayed there, you&#039;re stuck doing something like displaying UI from the ViewModel, which is equally bad, if not worse, than having code in the view.

In practice, most apps will not need code in the code-behind, and most code folks are tempted to put there really shouldn&#039;t be there, but I&#039;d rather not be dogmatic about it :)

Pete</description>
		<content:encoded><![CDATA[<p>When I first scanned this,what stood out to me was this bold quote:</p>
<p>&#8220;The user interface should be declared entirely in XAML, with zero code behind.&#8221;</p>
<p>While I agree that one should keep most logic out of the code-behind, I disagree that there should be zero code there.</p>
<p>View-specific code is ok to have there. That is, code that exists solely to perform a view function, such as building an animation or something, or setting up a relationship between two elements in a view when perhaps that is cumbersome to do in xaml, can be in the view. </p>
<p>Putting something into a specific visual state in response to a message from the VM is, perhaps, another case. Typically (99%) you&#8217;d handle that with binding, but that&#8217;s not always a reasonable route to take.</p>
<p>Other view code could be for things like displaying a file dialog. Displaying a file dialog is really a view function. Dealing with the results of the dialog should happen elsewhere. If not displayed there, you&#8217;re stuck doing something like displaying UI from the ViewModel, which is equally bad, if not worse, than having code in the view.</p>
<p>In practice, most apps will not need code in the code-behind, and most code folks are tempted to put there really shouldn&#8217;t be there, but I&#8217;d rather not be dogmatic about it <img src='http://reedcopsey.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Pete</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Better User and Developer Experiences – From Windows Forms to WPF with MVVM: Part 7, MVVM : Reed Copsey, Jr. -- Topsy.com</title>
		<link>http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-473</link>
		<dc:creator>Tweets that mention Better User and Developer Experiences – From Windows Forms to WPF with MVVM: Part 7, MVVM : Reed Copsey, Jr. -- Topsy.com</dc:creator>
		<pubDate>Thu, 07 Jan 2010 06:13:06 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/2010/01/06/better-user-and-developer-experiences-from-windows-forms-to-wpf-with-mvvm-part-7-mvvm/#comment-473</guid>
		<description>[...] This post was mentioned on Twitter by Reed Copsey, Jr., Caspar Kleijne. Caspar Kleijne said: RT @ReedCopsey: Blogging about moving from WinForms to #WPF with #MVVM in #csharp - Part 7, MVVM, is online: http://bit.ly/8cqsT1 [...]

[WORDPRESS HASHCASH] The comment&#039;s server IP (208.74.66.43) doesn&#039;t match the comment&#039;s URL host IP (74.112.128.10) and so is spam.</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Reed Copsey, Jr., Caspar Kleijne. Caspar Kleijne said: RT @ReedCopsey: Blogging about moving from WinForms to #WPF with #MVVM in #csharp &#8211; Part 7, MVVM, is online: <a href="http://bit.ly/8cqsT1" rel="nofollow">http://bit.ly/8cqsT1</a> [...]</p>
<p>[WORDPRESS HASHCASH] The comment&#8217;s server IP (208.74.66.43) doesn&#8217;t match the comment&#8217;s URL host IP (74.112.128.10) and so is spam.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
 