Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
Urgent: scroll jump problem - selected cell changes when window is smaller than grid's width and a cell is double clicked
posted

Hi,

I have found the following problem with my XamDataGrid. When the window containing the grid has a width smaller than the grid's width and the grid's horizontal scrollbar is set to a centre position, if a cell is double clicked, the grid scroll jumps horizontally and a different cell in a another field becomes the selected cell before it enters edit mode. This can be demonstated in my attached test app.

1) Run the app and resize the window so that only fields 2 to 6 are visible.

2) Now move the horizontal scrollbar to a centre position.

3) Next double click on one of the cells and you will see that a different cell in another field becomes the selected cell.

Is there a way of fixing this behaviour? This is an urgent issue holding back a production release, so a quick response would be greatly appreciated.

Thanks!

InfragisticsGridExample.zip
Parents
No Data
Reply
  • 54937
    Offline posted

    The problem is that since you are changing the EditorStyle when the selection changes the elements are getting recreated. As part of that the CellValuePresenter is trying to focus itself when it is being initialized and it is identified as the ActiveCell but since it hasn't been arranged yet it isn't at a valid location so its resulting in the scroll to the left edge. We can look into addressing this in the currently supported versions in an upcoming SR. I've also listed a workaround below:

            static MainWindow()
            {
                EventManager.RegisterClassHandler(typeof(CellValuePresenter), FrameworkElement.RequestBringIntoViewEvent, new RequestBringIntoViewEventHandler((o, e) => {
                    var cvp = o as CellValuePresenter;

                    if (LayoutInformation.GetLayoutSlot(cvp) == new Rect())
                    {
                        e.Handled = true;
                    }
                }));
            }

Children