Scrolling Datagrid in Windows s Mobile way to get rid of the scrollbar?
I have a very simple form using a compact structure. I have two search fields - search button and datagrid. The button sets the DataSource for the DataGrid on the form. I know that I can set the height and width in the DataGrid, but I don't want the user to have to use the scrollbars in the DataGrid since it has several hundred records. I just want the user to use scrolling on the form to scroll. How to do it?
source to share
I am assuming the behavior you want is for a vertical scroll bar that spans the overall height of the form to navigate through the records DataGrid
. This one DataGrid
doesn't take up all the space in the form.
You can add VScrollBar
to the side of the form and set its Max value for your total number of lines DataGrid
. Then attach to ValueChanged
the scrollbar event and manipulate the selected row of your DataGrid
. This will actually mimic the scrolling behavior DataGrid
.
The tricky part is hiding the scrollbar DataGrid
as there is no property to hide it. You can expand its width to the scroll bar is displayed outside of the screen, but do not forget to set the properties of the Form AutoScroll
value false
, so that it did not display a horizontal scroll bar, which would display kludge DataGrid
.
Depending on your application, you might want to explore with a ListView
property View
set to Details
. ListView
much easier to manipulate in a compact structure and better suited to your application. You can still use the same method VScrollBar
above and apply it to ListView
if you like.
source to share