Exception when clicking on the Allowances tab of the Project Information View

May 6, 2009 at 9:38 PM
When I run the Chapter 3 code, select a project, and view the project information, I receive the following exception when I click on the Allowances tab:

A TwoWay or OneWayToSource binding cannot work on the read-only property 'Title' of type 'SmartCA.Model.Projects.Allowance'.

Has anybody else received this error?  

What I had to do to fix this problem is set the Binding Mode to OneWay for both the Title and Amount text boxes Allowances ListView.  I am using VS2008 SP1 with .NET 3.5 SP1.  This exception is occurring because the Title and Amount properties for the Allowance class are both read-only.  I thought about creating a MutableAllowance class and adding them to a List, similar to the way the MutableAddress class works.  But, I decided against it as it seemed to be too much work, since the Allowances property of the Project class is read-only anyways.

Is setting the Binding Mode to OneWay for those two properties the proper way to fix that problem, without changing any intended functionality?
May 12, 2011 at 7:26 AM

Yes, setting the Mode to OneWay is the solution.  This is resolved in one of the recent ChangeSets that I submitted today.  This was one of the side effects of moving to .NET 4.0.  Thanks for catching that!