Windows store apps 在WinRT XAML应用程序ListView.CanDragItems中,当使用触摸时,仅允许沿一个方向拖动
请参阅以下非常基本的XAML。我在触摸模式的模拟器中运行它。我可以向右或向左拖动项目,但不能向下拖动。当使用鼠标模式时,它确实非常有效。在谷歌搜索之后,我看到了这条线,但它并没有帮到我Windows store apps 在WinRT XAML应用程序ListView.CanDragItems中,当使用触摸时,仅允许沿一个方向拖动,windows-store-apps,winrt-xaml,Windows Store Apps,Winrt Xaml,请参阅以下非常基本的XAML。我在触摸模式的模拟器中运行它。我可以向右或向左拖动项目,但不能向下拖动。当使用鼠标模式时,它确实非常有效。在谷歌搜索之后,我看到了这条线,但它并没有帮到我 <Page x:Class="App3.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/20
<Page
x:Class="App3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<ListView Background="AliceBlue"
AllowDrop="True" CanDragItems="True" SelectionMode="None" CanReorderItems="False"
IsItemClickEnabled="False" IsSwipeEnabled="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Margin="10">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Border Background="Blue" Width="100" Height="100"/>
</DataTemplate>
</ListView.ItemTemplate>
<x:String>s1</x:String>
<x:String>s2</x:String>
<x:String>s3</x:String>
</ListView>
</Grid>
</Page>
这是如此基本的东西,奇怪的是它对我不起作用。
有人知道任何解决方案或解决方法吗
谢谢
Meir我可能错了,但如果使用触摸,您只能垂直于滚动方向撕下项目。你链接到的论坛帖子中也提到了同样的问题。如果将IsSwipeEnable设置为False,则也会禁用此行为 如果希望ListView水平滚动,因为您已经更改了ItemsPanelTemplate的方向,您需要将以下内容添加到ListView:
现在,撕下将垂直工作,而不是水平工作,鉴于您当前的布局,这应该更直观。谢谢。我不知道ScrollMode属性。我仍然有兴趣知道这个语句是否只能撕掉垂直于滚动方向的项目才是最终正确的,并且无法解决。实际上,在我的实际布局中,我需要允许对角拖动。
ScrollViewer.HorizontalScrollMode="Enabled"
ScrollViewer.VerticalScrollMode="Disabled"