ScrollView Behavior

Feb 15, 2012 at 11:04 AM
Edited Feb 15, 2012 at 11:29 AM

I downloaded and installed this nice SDK, it's a very cool work, keep going on! I have a questing about the ScrollView implementation.

For example, if i place 3 UserControls inside the containing StackPanel and set the direction on the ScrollView to vertical, i can still drag around the stack in any direction (not just vertical). How can a disable the dragging behavior of the stack and only scroll if the content needs to be scrolled vertically.

I use the event ElementTapped and ElementHold but the ElementHold event is never fired. Is this because of the dragging behavior of the containing stack panel?

I need the behavior in your older example: UIKitShowCase example project

Tobias Wälty

Feb 15, 2012 at 8:35 PM

Ciao xeonit,

are you using latest svn release? Paste here the XAML code so I can reproduce the issue quickly and give you the tip to fix the issue.

I changed lot of stuff since that older example and pheraps in the latest available svn release not all funcionality were completed.

I hope to have a chance to update with actual work soon, because at least controls are completed and with some additional features.

Also the new MIRIA can be used on Windows Phone 7, on which I've been developing lately. It may be useful for extra/custom gesture handling and easy finger tracking. Windows Phone controls are really well done so certainly you won'ìt miss MIRIA.UIKIT there. Anyway i'ts cool that Windows Phone controls have many events with matching name with the one used in miria since it's beginning :) It means that I had a good intuition about that.



Feb 16, 2012 at 8:52 AM

Thank you, Gene

Yes i'm using the latest SVN version. The XAML code is extremely simple:

    <UIKit:ScrollView x:Name="OnlineScrollView" Grid.Row="2" Width="400" ScrollBarsEnabled="True" Direction="Vertical" HorizontalAlignment="Left">
      <StackPanel x:Name="OnlineStack" />

    <UIKit:ScrollView x:Name="DownloadedScrollView" Grid.Row="2" Grid.Column="1" Width="400" ScrollBarsEnabled="True" Direction="Vertical" HorizontalAlignment="Left">
      <StackPanel x:Name="DownloadedStack" />

The StackPanels are filled in code with Stack.Children.Add(uc). I see the problem in the two functions _gesturesinterpreter_Hold and FingerMove. In the FingerMove the transformhelper.Translate with new calculated x and y coordinates are called on the move operation with no respect to the desired direction. The function should also check if the content needs to be scrolled before it translates. For better hold behavior it may be better to use a threshold value before starting the translation, because the hold gesture conflicts with the scroll gesture ;-)

In the method _gesturesinterpreter_Hold the element is not found. I replaced the line

IEnumerable<UIElement> hits = VisualTreeHelper.FindElementsInHostCoordinates(this.TransformToVisual(Application.Current.RootVisual).Transform(e.HoldLocation), this);


IEnumerable<UIElement> hits = VisualTreeHelper.FindElementsInHostCoordinates(aE.HoldLocation, this);

Now the Hold operation is working correctly for me.


Feb 16, 2012 at 11:34 AM

Thank you xeonit :)

I'll check it out and eventually apply your suggested patch for the next svn commit.



Feb 19, 2012 at 8:18 PM

Hi Xeon,


I just committed to svn a new update with minor changes to ScrollView. Can you try your code within the new release?

Also ensure to have  UIKit:ScrollView.Hookable="True" property set for each children of your stackpanel.

If still not working, can you please provide an example xaml code for the children elements that are generated in code behind?

So I will fill in manually the stackpanel to reproduce better the issue. I tried with simple rectanlges but I couldn't see a wrong behaviour.