We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DataGrid Scrolling Behavior

Thanks to my nitpicking QA department I have an odd question (and no source code, sorry I''m working on it). I create a dataGrid with N columns. The Nth column is partially visible (i.e. part is on the screen, part is off screen). Whenever the user clicks on the last cell the entire grid shifts so that it becomes visible. AllowSelection is set to "Column, AlphaBlend". I went so far as to catch the SelectedCellChanging event and set the Cancel property to true. The grid still shifted as if it had set the current cell, shifted to make it visible and then cancelled. I''ve done the same with CurrentCellChanging to no avail. At this point, the only thing I can think of is to manually set the current cell once this sequence occurs to manually force its hand. Any thoughts?

2 Replies

AD Administrator Syncfusion Team April 19, 2004 10:19 PM UTC

I am not sure what you are trying to cacnel. Is is that you do not want to scroll the grid at all in this case. This means the cell on right will not be visible. How do you want you user to indicate he wants it visible???? I think you can prevent the scroll by handling LeftColChaning and cancelling it in this case. private void gridControl1_LeftColChanging(object sender, GridRowColIndexChangingEventArgs e) { if(this.gridControl1.ViewLayout.LastVisibleCol == this.gridControl1.ColCount) e.Cancel = true; }

AJ Aaron Jackson April 21, 2004 12:40 PM UTC

That did the trick, but to answer your question. This window is for better or worse a readonly window that the users drop on their screen and it displays scrolling stock market information. One of the options the user has is to turn off the scrollbars (see an earlier question of mine). When this is done, the window conserves space by not showing the scrollbar and the user will often compress the window to roughly the size of the table. Of course we''re fallible and we''ll make the window just a little smaller that the last column so that its "partially" visible (even though its 99.95% visible). When the user originates a mouse press (for instance for the context menu) it will cause the window to shift. Now with no visible means to move the columns back and they get frustrated (keys work, but its not something they''ll pick up immediately). Hope that clarifies it for you, thanks for the answer.

Live Chat Icon For mobile
Up arrow icon