I am creating an application using UltraWinGrid for a WinXP touchpad. I would like to get the scrolling capability in the grid like on an iPad - swipe up to scroll down, swipe down to scroll up. Can I get this capability?
If it's not possible in WinXP, is it possible in WIn7?
Hello,
Currently UltraGrid doesn’t support such functionality, but you could achieve this, if you are handling mouse move event of the UltraGrid and use code like:
if (ultraGrid1.Capture)
{
int abs = Math.Abs(e.Y - oldPosition.Y);
if ( abs> 10)// determine if user hit to scroll
int adjust = (e.Y - oldPosition.Y);
int sign = adjust > -1 ? -1 : 1;//direction of scrolling - up or down
//cause scrolling to be fast at the beginning and to slow down at the end
for (int i = 0; i < abs; i +=1)
ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollPosition += (int)(((e.Y - oldPosition.Y) + sign*i)*0.02);
ultraGrid1.Refresh();
}
else
ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollPosition += e.Y - oldPosition.Y;
oldPosition = e.Location;
I am attaching the sample which I have created.
Please let me know if you have any further questions.
Thanks for your insight. I see what you are getting at.
There are, however, 2 issues:
1) The scroll is in the wrong direction than I wanted. But that is easily solved by changing the += to -=. So that's OK.
2) The more difficult problem is that the scroll is not in sync with the mouse movement. If you MouseDown on a row, and move the mouse just a drop, the data row moves alot. In other words, the row you have the MouseDown on doesn't graphically sync with the mouse movement. Is there a way to keep the two in sync, so that the row you've MouseDowned on stays under the mouse as you move it? That's the way it works on an iPad, and that's the way a user would intuitively expect it to work.
Thanks for any assistance.
Scrolling of UltraGrid is row based and the component does not support pixel based scrolling. This is the reason because of UltraGrid will “jump” at least with one row. I have modified the sample in order to achieve something closer to your requirements.
http://sephirex.wang/1.avi video url
Hi Sir.
I used the code you provided, but there have some problem, kindly refer to the video, please.
I can't stop when the 'grid' scrolling , it automatic scroll down and up.
Thank you.
Regards,
James
What code are you using for moving to the next/previous cards? Is it something like (where Me is the grid object):
Me.ActiveRowScrollRegion.ScrollRowIntoView(Me.ActiveRow.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next))
No I was end up adding two buttons on the sides of the grid. Move Previous and Move Next. Move next highlights the next card and move previous highligteds the preious card.
Let me know know if you find any thing..
I am also looking to implement this in a Card View grid. Did you have any success with this?