Touch events not working for me in managed SDK
Posted: 13 Sep 2019, 17:30
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.