I am trying to disable a number of text boxes intended for displaying data (not edit) in one of my UserControls. However, for some reason I can not get the textBoxes to disable properly.
I've set "ApplyAuthorization on readWriteAuthorization" to true and the textBoxes are databound to the correct properties.
I've also added the following lines to the CanWriteProperty
of my object:
if (propertyName == OpeningDateProperty.Name) return false;
if (propertyName == ChangeDateProperty.Name) return false;
if (propertyName == CloseDateProperty.Name) return false;
return base.CanWriteProperty(propertyName);
I can't figure out what I'm doing wrong here. I've implemented pretty much the same thing recently in other UserControls without any problems...
I am using Windows Forms in C# .NET (Visual Studio 2008)
EDIT: The code snippets and the properties are taken from my customer object. The date represent opening, last change and closure of the customer account. They are never supposed to be edited at all and in fact in the old sollution they are represented by textLabels, however we now want to use a text box and make the property's CanWriteProperty false.
I realise that the information might be sort of scarce, but I am looking for what I might have forgotten in this process.
EDIT: We are using CSLA as well and I guess (I'm new at this whole thing) this has something to do with why we want to do it like this.
EDIT (Sollution): As you can see in my answer below, the problem was that I had not set up the CurrentItemChanged
event like I should have.