Hello,
I am having an issue where I have to adjust the cell width to accomodate a dynamic control at runtime. The control may be composed of numerous text boxes and we won't know the size until after the Loaded event gets called on it.
My current workaround is to wire up to the Loaded event of the control in the EditModeStarted event on the grid. Once the control gets loaded i do the following:
_currentGrid.ActiveCell.Field.Settings.LabelWidth = newWidth;
Unfortunately, it seems that LabelWdith changes causes the active cell to no longer be in edit mode and so our focus never goes into the control. Is there any way to address this issue?
Also, this only seems to occure when tabbing into the field. Directly clicking does not cause the cell to exit edit mode.
Thanks.
Please take a look at this blog post about hosting any controls in the cells by Andrew Smith. This way you should be able to keep the focus where you expect it to be:
http://blogs.infragistics.com/blogs/andrew_smith/archive/2009/03/27/hosting-wpf-controls-in-a-xamdatagrid-cell.aspx