Hi,
I want to show active row in visible area. I set the ActiveRowScrollPosition property after binding and sorting. It is covered while loading and sorting. But if i used outlook group by at that tiem it is failing. How do i correct this problem.
Steps to Reproduce:
1. In the After row activate event i set the ActiveRowScrollPosition.
2. Drag the column and put that into top.
3. Then remove the group by removing column from top.
4. It is working fine now. that is ActiveRow is in visible area.
5. Then Drag the column and put that into top.
6. Expand some other row from group
7. Select one row from that.
8. Now remove the group, it won't show activerow in visible area. because ActiveRow is not available.
How do i correct this Issue?
I couldn't test the first issue, because none of the rows in your sample have any child rows. Or at least I could not find any.
But anyway, I think the problem is that you are assuming the ActiveRow didn't change. You are just scrolling the current ActiveRow into view inside of AfterSortChange.
When you group or ungroup the grid, the ActiveRow may be changed. In fact, the row objects you have before the grouping may not even be the same objects you get after you group or ungroup. Sometimes rows are destroyed and recreated in order to build the new hierarchy.
So what you probably have to do is record some key information about the ActiveRow inside the BeforeSortChange event. Then in AfterSortChange, search through the grid for the matching row and activate it.
Thanks Mike. I fired BeforeSortChange event and i set the ProcessMode to synchronous. If i select any row with in the group and i removed the group the selected row is in visible area. but in opposite direction is not working. that means Without grouping i select one row in second band. but that one is not visible while grouping. How do i achive that. Also if i select one row from Second row and i grouped using other column and i removed the group at that time active row is not present in the grid. How do i correct that.
I created sample application for that. Can you check it out?
Grouping is tightly ties to sorting. So try the AfterSortChange event.
I'm not entirely sure that will work, as the grouping might be done asynchronously. So you might not be able to scroll inside that event unless you also handle the BeforeSortChange event and set the ProcessMode to synchronous. Or... you might be able to just use AfterSortChange to invoke a method that scrolls the active row into view, instead of calling the code directly within the event.
Which event i need to handle this code (grid.ActiveRowScrollRegion.ScrollRowIntoView). I want to show the active row even if i add group or remove group.
can you tell me the event?
I'm afraid I do not understand your question. What is "ActiveRowScrollPosition"? This is not a property I'm familiar with.
The grid has an ActiveRow, which is synchronized with the current position of the BindingManager in Dot.
If you are trying to bring the ActiveRow into view, you can use grid.ActiveRowScrollRegion.ScrollRowIntoView. If the row is a child row or the child of a GroupByRow, then you probably need to expand the parent chain so that the row is visible. You can do this quite easily by simply calling row.Parent.Expanded = true. You will, of course, need to check that Parent is not null, first. And then you will also need to walk up to the parent's parent, etc.