This DataGridColumnStyle class supports true/false
values, representing them as a checkbox. If you set the
AllowNull property, you can extend this to
true/false/null support, with a tristate checkbox.
In addition to the base behavior, you can set the
TrueValue, FalseValue, and
NullValue properties (the object values that
represent true, false, and null), in the particular data type of the
bound column.
public class DataGridBoolColumn : DataGridColumnStyle {
// Public Constructors
public DataGridBoolColumn();
public DataGridBoolColumn(System.ComponentModel.PropertyDescriptor prop);
public DataGridBoolColumn(System.ComponentModel.PropertyDescriptor prop, bool isDefault);
// Public Instance Properties
public bool AllowNull{set; get; }
public object FalseValue{set; get; }
public object NullValue{set; get; }
public object TrueValue{set; get; }
// Protected Instance Methods
protected internal override void Abort(int rowNum); // overrides DataGridColumnStyle
protected internal override bool Commit(CurrencyManager dataSource, int rowNum); // overrides DataGridColumnStyle
protected internal override void ConcedeFocus(); // overrides DataGridColumnStyle
protected internal override void Edit(CurrencyManager source, int rowNum,
System.Drawing.Rectangle bounds, bool readOnly, string instantText,
bool cellIsVisible); // overrides DataGridColumnStyle
protected internal override void EnterNullValue(); // overrides DataGridColumnStyle
protected internal override object GetColumnValueAtRow(CurrencyManager lm,
int row); // overrides DataGridColumnStyle
protected internal override int GetMinimumHeight(); // overrides DataGridColumnStyle
protected internal override int GetPreferredHeight(System.Drawing.Graphics g,
object value); // overrides DataGridColumnStyle
protected internal override Size GetPreferredSize(System.Drawing.Graphics g,
object value); // overrides DataGridColumnStyle
protected internal override void Paint(System.Drawing.Graphics g,
System.Drawing.Rectangle bounds, CurrencyManager source, int rowNum); // overrides DataGridColumnStyle
protected internal override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds,
CurrencyManager source, int rowNum, bool alignToRight); // overrides DataGridColumnStyle
protected internal override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds,
CurrencyManager source, int rowNum, System.Drawing.Brush backBrush,
System.Drawing.Brush foreBrush, bool alignToRight); // overrides DataGridColumnStyle
protected internal override void SetColumnValueAtRow(
CurrencyManager lm, int row, object value); // overrides DataGridColumnStyle
// Events
public event EventHandler AllowNullChanged;
public event EventHandler FalseValueChanged;
public event EventHandler TrueValueChanged;
}