DateTimeCellModel Calenadar appears in wrong place
There is a strange behaviour in DateTimeCellModel.
Example attached.
Step 0: Run attached solution
Step 1: Single click on one of grid cells
Step 2: Now click on the textbox in right upper corner
Step 3: Click on "dropdown" button (with small triangle) in previously clicked cell
Calendar appears in right bottom corner of the screen. How can I fix this problem?
DateTimePickerCellBug.zip
Example attached.
Step 0: Run attached solution
Step 1: Single click on one of grid cells
Step 2: Now click on the textbox in right upper corner
Step 3: Click on "dropdown" button (with small triangle) in previously clicked cell
Calendar appears in right bottom corner of the screen. How can I fix this problem?
DateTimePickerCellBug.zip
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
October 1, 2007 03:08 PM UTC
You can avoid the problem by hiding the DatTimePicker when the grid loses focus. At the bottom of the renderer's contructor, add this code to subscribe to the event.
Then use this handler.
grid.LostFocus += new EventHandler(grid_LostFocus);
Then use this handler.
void grid_LostFocus(object sender, EventArgs e)
{
if (dateTimePicker.Visible)
{
this.dateTimePicker.Hide();
}
}
VA
Valerij
October 2, 2007 07:27 AM UTC
You mean something like this for GDBG:
void gridDataBoundGrid1_LostFocus(object sender, EventArgs e)
{
if (gridDataBoundGrid1.CurrentCell.Renderer.Control.Visible)
gridDataBoundGrid1.CurrentCell.Renderer.Control.Hide();
}
?
Is there a way to avoid this problem at DateTimeCellModel component level? I need to implement datetimepicker cell in quite big application where a lot grids are used. It would be much easer to make changes in one place then add event handler to each grid.
void gridDataBoundGrid1_LostFocus(object sender, EventArgs e)
{
if (gridDataBoundGrid1.CurrentCell.Renderer.Control.Visible)
gridDataBoundGrid1.CurrentCell.Renderer.Control.Hide();
}
?
Is there a way to avoid this problem at DateTimeCellModel component level? I need to implement datetimepicker cell in quite big application where a lot grids are used. It would be much easer to make changes in one place then add event handler to each grid.
AD
Administrator
Syncfusion Team
October 2, 2007 08:52 AM UTC
I was suggesting doing this in the renderer code.
public DateTimeCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
: base(grid, cellModel)
{
dateTimePicker = new MyDateTimePicker();
dateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Short;
dateTimePicker.NullString = "";
dateTimePicker.ShowUpDown = false;
dateTimePicker.ShowCheckBox = false;
dateTimePicker.ShowDropButton = true;
dateTimePicker.Border3DStyle = Border3DStyle.Flat;
grid.Controls.Add(dateTimePicker);
//show & hide to make sure it is initilized properly for teh first use...
dateTimePicker.Show();
dateTimePicker.Hide();
this.SetControl(dateTimePicker);
grid.LostFocus += new EventHandler(grid_LostFocus);//added.......
}
//added.......
void grid_LostFocus(object sender, EventArgs e)
{
if (dateTimePicker.Visible)
{
this.dateTimePicker.Hide();
}
}
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
VA Valerij
- Oct 1, 2007 08:33 AM UTC
- Oct 2, 2007 08:52 AM UTC