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?