In regard to your second question, if you do not explicilty set teh GridStyleInfo.Format for the cell, then you can type something like 4/4 and teh grid will populate the missing datetime information. But if you provide the format, then the grid uses the ParseExact to enforce the format. One way around this is to handle CurrentCellValidating and take the incoming string and populate it properly so there are no missing pieces.
//in form load
this.gridControl1.ColWidths[2] = 120;
GridStyleInfo style = this.gridControl1[2,2];
style.BackColor = Color.LightBlue;
style.CellValue = DateTime.Now;
style.CellValueType = typeof(DateTime);
style.Format = "g";
private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridStyleInfo style = this.gridControl1[cc.RowIndex, cc.ColIndex];
if(style.Format.Length > 0 && style.CellValueType == typeof(DateTime))
{
string val = cc.Renderer.ControlText;
try
{
DateTime dt = DateTime.Parse(val); //takes almost anything
val = dt.ToString(style.Format); //force it to the desired format
cc.Renderer.Control.Text = val; //set it into the control
}
catch
{} //empty catch
}
}
With respect to your first question, our upcoming 1.6 release has two new events designed to handle exactly this task, QueryCellFormattedText and SaveCellFormattedText. 1.6 goes into beta this week.