<?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 : Computed fields not updating in UI</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Computed fields not updating in UI</description>
  <pubDate>Sun, 12 Apr 2026 22:20:21 -700</pubDate>
  <lastBuildDate>Wed, 10 Aug 2011 06:59:01 -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=2875</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>Computed fields not updating in UI : Much cleaner, thank Silvio!  ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2875&amp;PID=11392#11392</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1221" rel="nofollow">Togas</a><br /><strong>Subject:</strong> 2875<br /><strong>Posted:</strong> 10-Aug-2011 at 6:59am<br /><br /><span ="Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Much cleaner, thank Silvio!</div></span>]]>
   </description>
   <pubDate>Wed, 10 Aug 2011 06:59:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2875&amp;PID=11392#11392</guid>
  </item> 
  <item>
   <title>Computed fields not updating in UI :   Hi Togas,You will need to...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2875&amp;PID=11384#11384</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2875<br /><strong>Posted:</strong> 09-Aug-2011 at 5:53pm<br /><br />Hi Togas,<div>&nbsp;</div><div>You will need to raise PropertyChanged when any of the 3 property values is updated. </div><div>&nbsp;</div><div>However, you don't need to call a method to calculate it each time assuming your calculated property getter already does so.</div><div>&nbsp;</div><div>&nbsp;</div><div><span style="color: blue;">Partial</span> <span style="color: blue;">Public</span> <span style="color: blue;">Class</span> <span id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">Order</span><br>&nbsp; <span style="color: blue;">Inherits</span> ibem.entity&nbsp;<br><br>&nbsp; <span style="color: blue;">Private</span> _TotalMonthlyPayment <span style="color: blue;">As</span> <span style="color: blue;">Decimal</span><br>&nbsp; <span style="color: blue;">Private</span> TotalInit <span style="color: blue;">As</span> <span style="color: blue;">Boolean</span> = <span style="color: blue;">False</span>&nbsp;<br><br>&nbsp; &lt;<span>AfterSet</span>(<span>EntityPropertyNames</span>.MonthlyPayment)&gt; _<br>&nbsp; &lt;<span>AfterSet</span>(<span>EntityPropertyNames</span>.OptionPayment)&gt; _<br>&nbsp; &lt;<span>AfterSet</span>(<span>EntityPropertyNames</span>.UpgradeAmount)&gt; _<br>&nbsp; <span style="color: blue;">Public</span> <span style="color: blue;">Sub</span> FireTotalMonthlyPaymentChanged(<span style="color: blue;">ByVal</span> args <span style="color: blue;">As</span> <span>PropertyInterceptorArgs</span>(<span style="color: blue;">Of</span> <span>Order</span>, <span>&#091;String&#093;</span>))&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;OnPropertyChanged(<span style="color: blue;">New</span> <span>PropertyChangedEventArgs</span>(<span>"TotalMonthlyPayment"</span>))<br>&nbsp; <span style="color: blue;">End</span> <span style="color: blue;">Sub</span><br>&nbsp;<br>&nbsp; <span style="color: blue;">Public</span> <span style="color: blue;">ReadOnly</span> <span style="color: blue;">Property</span> TotalMonthlyPayment() <span style="color: blue;">As</span> <span style="color: blue;">Decimal</span><br>&nbsp;&nbsp;&nbsp; <span style="color: blue;">Get</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return MonthlyPayment.GetValueOrDefault + OptionPayment.GetValueOrDefault + UpgradeAmount.GetValueOrDefault</div><div>&nbsp;&nbsp;&nbsp; <span style="color: blue;">End</span> <span style="color: blue;">Get</span><br>&nbsp; <span style="color: blue;">End</span> <span style="color: blue;">Property</span><br></div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Tue, 09 Aug 2011 17:53:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2875&amp;PID=11384#11384</guid>
  </item> 
  <item>
   <title>Computed fields not updating in UI :   I added a field to my entity...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2875&amp;PID=11369#11369</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1221" rel="nofollow">Togas</a><br /><strong>Subject:</strong> 2875<br /><strong>Posted:</strong> 08-Aug-2011 at 11:31am<br /><br />I added a field to my entity to show the total of 3 fields.<div><br></div><div><br></div><div><br></div><div><pre id="" style="font-family: c&#111;nsolas; "><span style="color: blue; ">Public</span>&nbsp;<span style="color: blue; ">ReadOnly Property</span>&nbsp;TotalMonthlyPayment()</pre><pre id=""><span ="apple-tab-span"="" style="font-family: c&#111;nsolas; white-space: pre; ">	</span><font ="apple-style-span"="" face="c&#111;nsolas">Return MonthlyPayment.GetValueOrDefault&nbsp;+&nbsp;OptionPayment.GetValueOrDefault&nbsp;+&nbsp;UpgradeAmount.GetValueOrDefault</font><pre style="font-family: c&#111;nsolas; "><span style="color: blue; ">End</span>&nbsp;<span style="color: blue; ">Sub</span></pre><pre style="font-family: c&#111;nsolas; "><span style="color: blue; "><br></span></pre><pre style="font-family: c&#111;nsolas; "><font ="apple-style-span"="" color="#0000ff" id="">If I changed one of the 3 values in my UI the total field is not updated.  I found this article and it seems like it should be.</font></pre><pre id="" style="font-family: c&#111;nsolas; "><font ="apple-style-span"="" color="#0000ff"><a href="http://www.ideablade.com/DevForceClassic/TechTips/techtip_refreshing_dependent_parents.htm" target="_blank">http://www.ideablade.com/DevForceClassic/TechTips/techtip_refreshing_dependent_parents.htm</a></font></pre><pre id="" style="font-family: c&#111;nsolas; ">Specifically here:</pre><pre id="" style="font-family: c&#111;nsolas; "><span ="apple-style-span"="" style="font-family: Helvetica, Arial, sans-serif; line-height: 17px; white-space: normal; ">"The answer depends upon whether the independent property that got changed lives in the same object, or an external one. Suppose, for example, that you have an Employee class that defines a (computed) Age property whose values depends upon the Employee’s (persistable) BirthDate (as illustrated in many of our Fundamentals tutorials). If a user changes the BirthDate value, PropertyChanged will fire on the Employee instance. Data bindings to that Employee in a form or UserControl listen for this event, and they will notify their controls when it occurs. All the data bindings for the Employee instance will get updated, so the Age value will be updated to correspond to the new BirthDate."</span></pre><pre id="" style="font-family: c&#111;nsolas; "><span ="apple-style-span"="" style="font-family: Helvetica, Arial, sans-serif; line-height: 17px; white-space: normal; "><br></span></pre><pre id=""><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; " id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">If I'm reading this right I shouldn't need to do anything for my computed value to update but that's not what I'm seeing.</span></font></pre><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; "><br></span></font></pre><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; "><br></span></font></pre><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; "><br></span></font></pre><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; " id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">I did write this and it works but it seems like a lot of work for simple calculated fields, am I missing something?</span></font></pre><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; "><br></span></font></pre><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"><font ="apple-style-span"="" face="Helvetica, Arial, sans-serif"><span ="apple-style-span"="" style="line-height: 17px; white-space: normal; "><pre id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown" style="font-family: c&#111;nsolas; "><span style="color: blue; ">Partial</span>&nbsp;<span style="color: blue; ">Public</span>&nbsp;<span style="color: blue; ">Class</span>&nbsp;<span id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown" style="color: rgb43, 145, 175; ">Order</span><br>&nbsp;&nbsp;<span style="color: blue; ">Inherits</span>&nbsp;ibem.entity<br> <br><br>&nbsp;&nbsp;<span style="color: blue; ">Private</span>&nbsp;_TotalMonthlyPayment&nbsp;<span style="color: blue; ">As</span>&nbsp;<span style="color: blue; ">Decimal</span><br>&nbsp;&nbsp;<span style="color: blue; ">Private</span>&nbsp;TotalInit&nbsp;<span style="color: blue; ">As</span>&nbsp;<span style="color: blue; ">Boolean</span>&nbsp;=&nbsp;<span style="color: blue; ">False</span><br> <br><br>&nbsp;&nbsp;&lt;<span style="color: rgb43, 145, 175; ">AfterSet</span>(<span style="color: rgb43, 145, 175; ">EntityPropertyNames</span>.MonthlyPayment)&gt;&nbsp;_<br>&nbsp;&nbsp;&lt;<span style="color: rgb43, 145, 175; ">AfterSet</span>(<span style="color: rgb43, 145, 175; ">EntityPropertyNames</span>.OptionPayment)&gt;&nbsp;_<br>&nbsp;&nbsp;&lt;<span style="color: rgb43, 145, 175; ">AfterSet</span>(<span style="color: rgb43, 145, 175; ">EntityPropertyNames</span>.UpgradeAmount)&gt;&nbsp;_<br>&nbsp;&nbsp;<span style="color: blue; ">Public</span>&nbsp;<span style="color: blue; ">Sub</span>&nbsp;FireTotalMonthlyPaymentChanged(<span style="color: blue; ">ByVal</span>&nbsp;args&nbsp;<span style="color: blue; ">As</span>&nbsp;<span style="color: rgb43, 145, 175; ">PropertyInterceptorArgs</span>(<span style="color: blue; ">Of</span>&nbsp;<span style="color: rgb43, 145, 175; ">Order</span>,&nbsp;<span style="color: rgb43, 145, 175; ">&#091;String&#093;</span>))&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;CalulateTotalMonthlyPayment()<br>&nbsp;&nbsp;&nbsp;&nbsp;OnPropertyChanged(<span style="color: blue; ">New</span>&nbsp;<span style="color: rgb43, 145, 175; ">PropertyChangedEventArgs</span>(<span style="color: rgb163, 21, 21; ">"TotalMonthlyPayment"</span>))<br>&nbsp;&nbsp;<span style="color: blue; ">End</span>&nbsp;<span style="color: blue; ">Sub</span><br> <br>&nbsp;&nbsp;<span style="color: blue; ">Public</span>&nbsp;<span style="color: blue; ">Sub</span>&nbsp;CalulateTotalMonthlyPayment()<br>&nbsp;&nbsp;&nbsp;&nbsp;_TotalMonthlyPayment&nbsp;=&nbsp;MonthlyPayment.GetValueOrDefault&nbsp;+&nbsp;OptionPayment.GetValueOrDefault&nbsp;+&nbsp;UpgradeAmount.GetValueOrDefault<br>&nbsp;&nbsp;<span style="color: blue; ">End</span>&nbsp;<span style="color: blue; ">Sub</span><br> <br>&nbsp;&nbsp;<span style="color: blue; ">Public</span>&nbsp;<span style="color: blue; ">ReadOnly</span>&nbsp;<span style="color: blue; ">Property</span>&nbsp;TotalMonthlyPayment()&nbsp;<span style="color: blue; ">As</span>&nbsp;<span style="color: blue; ">Decimal</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">Get</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">If</span>&nbsp;TotalInit&nbsp;<span style="color: blue; ">Then</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">Return</span>&nbsp;_TotalMonthlyPayment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">Else</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CalulateTotalMonthlyPayment()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">Return</span>&nbsp;_TotalMonthlyPayment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">End</span>&nbsp;<span style="color: blue; ">If</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">End</span>&nbsp;<span style="color: blue; ">Get</span><br>&nbsp;&nbsp;<span style="color: blue; ">End</span>&nbsp;<span style="color: blue; ">Property</span><br> </pre></span></font></pre></pre></div><span style="font-size:10px"><br /><br />Edited by Togas - 09-Aug-2011 at 6:36am</span>]]>
   </description>
   <pubDate>Mon, 08 Aug 2011 11:31:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2875&amp;PID=11369#11369</guid>
  </item> 
 </channel>
</rss>