Hi,
I have implemented the MergedCellEvaluator to merge cells having similar text. I want to edit the mergeCell so that when i changes the value of any one cell, the value should reflect to all cells which are merged with that cell. Is there any way to do this?
Thanks in Advance,
Ujwal Salunkhe
Thanks Mike,
My problem is resolved. I have used textbox. When user tries to edit the merged cell, i displayed this text box in front of that merged cell.
Thank you,
Hi Ujwal,
This is tricky. I'm not sure if a CreationFilter is the right way to go here. It might work, but I really couldn't say without trying it.
When the grid cell goes into edit mode, the grid displays a derived inbox textbox control over the cell - for most cells. Mask or checkbox cells are different, but it's true for regular text cells. What you might be able to do is trap the ControlAdded event of the grid. This event is often hidden from the PropertyGrid at design-time, so you may have to hook it at run-time. This will allow you to trap when the TextBox is added to the grid and you could try changing the size and positon of the TextBox so that it covers all of the merged cells. I guess you would loop through your stored collection of merged cells and use GetUIElement on each one and then get the Rect of each element and union them all together to get the total area. I'm not sure if this will work, but it seems like a place to start, anyway. I suspect that this is going to be more difficult, though.
Hi Mike,
It is now working fine. Thanks a lot.
Another problem with Merge Cell is, during editing, displayUI of the merge cells gets divided into 2-3 portions which is not looking good. I am trying to solve this problem by implementing seperated creation filter class which is inherited from IUIElementCreationFilert. In this class I am tring to display textbox in MergeCellUI whenever MergeCellUIElement gets created. Will this work? Is there any way to solve this problem?
Thanks,
While the cell is in edit mode, it gets split from the other merged cells. So it is not merged at that point. What you will probably have to do is use the BeforeEnterEditMode event and record the merged cells before they get split up. You could store them in a List and then use them in the CellChange event.
I tried getting list of all mergedcells by GetMergedCell() method in BeforeCellUpdate(..), AfterCellUpdate(...) and CellChange(..) events but it returns null every time. Can you please let me know why it returns null everytime in these events.