<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : When use ItemViewModel</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : When use ItemViewModel</description>
  <pubDate>Tue, 14 Apr 2026 07:26:06 -700</pubDate>
  <lastBuildDate>Mon, 11 Jun 2012 23:41:09 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3492</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>When use ItemViewModel :   The criteria used to wrap...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3492&amp;PID=13818#13818</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3492<br /><strong>Posted:</strong> 11-Jun-2012 at 11:41pm<br /><br />The criteria used to wrap an entity is whether you need additional properties and/or methods specifically for the UI. UI logic never belongs on the entity itself. The entity is a data container for your business data. It models your business not the UI. It's the responsiblity of a ViewModel to provide UI logic around your entities. So, in TempHire, for the addresses and phone numbers, I need a property to enable/disable the Delete button next to each item in the UI based on the state of the entity. This is pure UI logic and therefore the entity is wrapped in an ItemViewModel. <div>&nbsp;</div><div>The following is the property for the AddressItemViewModel. It only enables the Delete button if there's more than one address and the current address is not the primary address.</div><div><pre style=": white; color: black; font-family: C&#111;nsolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">public</span>&nbsp;<span style="color: blue;">bool</span>&nbsp;CanDelete&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">get</span>&nbsp;{&nbsp;<span style="color: blue;">return</span>&nbsp;!Item.Primary&nbsp;&amp;&amp;&nbsp;(Item.StaffingResource.Addresses.Count&nbsp;&gt;&nbsp;1);&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</pre></div><div>&nbsp;</div><div>which is then bound to the IsEnabled attribute of the Button.</div><div>&nbsp;</div><div><pre style=": white; color: black; font-family: C&#111;nsolas;"><span style="color: rgb163, 21, 21;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;</span><span style="color: rgb163, 21, 21;">Button</span><span style="color: red;">&nbsp;Width</span><span style="color: blue;">=</span><span style="color: blue;">"60"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">&nbsp;Height</span><span style="color: blue;">=</span><span style="color: blue;">"25"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">&nbsp;Margin</span><span style="color: blue;">=</span><span style="color: blue;">"2"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">&nbsp;HorizontalAlignment</span><span style="color: blue;">=</span><span style="color: blue;">"Left"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">&nbsp;cal</span><span style="color: blue;">:</span><span style="color: red;">Message.Attach</span><span style="color: blue;">=</span><span style="color: blue;">"Delete($dataContext)"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">&nbsp;Content</span><span style="color: blue;">=</span><span style="color: blue;">"Delete"</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;">&nbsp;IsEnabled</span><span style="color: blue;">="{</span><span style="color: rgb163, 21, 21;">Binding</span><span style="color: red;">&nbsp;CanDelete</span><span style="color: blue;">}</span><span style="color: blue;">"</span><span style="color: blue;">&nbsp;/&gt;</span></pre></div>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 23:41:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3492&amp;PID=13818#13818</guid>
  </item> 
  <item>
   <title>When use ItemViewModel :   Hi.I has been studying the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3492&amp;PID=13814#13814</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1114" rel="nofollow">rbautistaole</a><br /><strong>Subject:</strong> 3492<br /><strong>Posted:</strong> 11-Jun-2012 at 7:16pm<br /><br />Hi.<div>I has been studying the TempHire sample, and i observed that some entities are wrapped to ViewModels to be added to ObservableCollections like the Phone and Adress entities and another entities are not wrapped like Rate and Skill entities. My questios is which criteria is&nbsp;used to wrap or not wrap the entities in ViewModels?</div><div>&nbsp;</div><div>thanks ind advanced </div><div>Ramiro Bautista.</div>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 19:16:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3492&amp;PID=13814#13814</guid>
  </item> 
 </channel>
</rss>