If you just want the controls to always be enabled, then Trent's suggestion is very easy.
However, if you do want them to be unavailable until the user explicitly edits a record and just change TextBoxes to become readonly rather than disabled, so you can select text and scroll with multiline textboxes, then sub-class is a nice way to go.
yes.. I see.. but subclassing I just don't call "easy way" to solve the problem .
Actually it is very easy. Here the entire class:
using MicroFour.StrataFrame.UI.Windows.Forms;
public class TextBox : Textbox, IBusinessBindable
{
public TextBox() { }
// This replaces the BindingEditable property of the base class with out own.
// This changes the ReadOnly property rather than the enabled property, which
// allows for text to be selected and for scrolling.
public new bool IBusinessBindable.BindingEditable
{
get { return !this.ReadOnly; }
set { this.ReadOnly = !value; }
}
}
I've attached a solution. This uses the StrataFrameSample db and shows how the standard SF Textbox behaves and how a readonly one would work. It also shows another way to go, handling the EditingStateChanged event of the BO and manually setting the readonly state (not what Trent was talking about...but I was confused for a bit ).
I hope one of these ways gets you going!