- darthmaule2
- Posts: 98
- Joined:
Touch events not working for me in managed SDK
I have a ListView control defined like this:
And connect TouchDown in code-behind like this:
TouchDown is connected in ConnectEvent but never fires for me.
This same ListView also has a ScrollViewer but it doesn't pan with touch:
Do I have to turn touch events on somehow? Or, is there something that I'm doing which could be turning them off?
Thanks.
Code: Select all
<ListView x:Name="CurrentDirectoryListView"
SelectionMode="Single"
Style="{StaticResource FileManagerListViewStyle}"
ItemContainerStyle="{StaticResource FileManagerListViewItemStyle}"
ItemsSource="{Binding CurrentDirectoryContents}"
TouchDown="OnTouchDown">
And connect TouchDown in code-behind like this:
Code: Select all
protected override bool ConnectEvent(object source, string eventName, string handlerName)
{
if (eventName == "TouchDown" && handlerName == "OnTouchDown")
{
((ListView)source).TouchDown += OnTouchDown;
return true;
}
return false;
}
private void OnTouchDown(object sender, TouchEventArgs args)
{
throw new System.NotImplementedException();
}
This same ListView also has a ScrollViewer but it doesn't pan with touch:
Code: Select all
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
<ScrollViewer Margin="1" Style="{StaticResource SimpleScrollViewer}" CanContentScroll="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" PanningMode="VerticalOnly" Focusable="false" >
<ItemsPresenter >
</ItemsPresenter>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
Thanks.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Touch events not working for me in managed SDK
Connecting to TouchDown event in the ListView won't work if you have a ScrollViewer inside because the ScrollViewer will handle the event before it reaches the ListView. You will probably want to connect to PreviewTouchDown event instead.
About touch events not working for the ScrollViewer, which platform are you using? Events are injected into the View by the Display implementation corresponding to each platform, perhaps something is missing yet.
About touch events not working for the ScrollViewer, which platform are you using? Events are injected into the View by the Display implementation corresponding to each platform, perhaps something is missing yet.
Who is online
Users browsing this forum: No registered users and 80 guests