代码之家  ›  专栏  ›  技术社区  ›  WhoKnows

(UWP)ScrollViewer PanningMode-是否存在?

  •  0
  • WhoKnows  · 技术社区  · 9 年前

    我真的希望我没有在这里做什么蠢事,但我正在努力做出(快?)UWP Windows 10测试应用程序,其中包括一个ScrollViewer来进行图像滚动。ScrollViewer工作正常,直到我尝试使用PanningMode,它只是说它不存在。我看到另一个帖子,PanningMode=“Both”不起作用,但这一点也没有帮助,没有解决我遇到的问题。是因为我很愚蠢,比如因为某种原因不存在PanningMode,还是出了什么问题?这是我的主页。xaml(目前还没有优化或达到任何真正的标准),我希望它已经足够了。

    <Page
    x:Class="NewLunderground.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NewLunderground"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    
        <ScrollViewer x:Name="ScrollusViewus" HorizontalAlignment="Left" VerticalAlignment="Top" ZoomMode="Enabled" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Visible" PanningMode="Both"  Height="Auto" Width="Auto">
            <Image x:Name="mapImage" HorizontalAlignment="Left" VerticalAlignment="Top" Source="Assets/map.png" Stretch="None" ManipulationMode="All" ScrollViewer.HorizontalScrollBarVisibility="Visible" Width="Auto" Height="Auto"/>
        </ScrollViewer>
    
    </Grid>
    

    1 回复  |  直到 9 年前
        1
  •  1
  •   nico    9 年前

    PanningMode属性在WPF应用程序中指定ScrollViewer应该如何对触摸操作做出反应。您可以确定它应该水平、垂直还是同时滚动。然而,这在UWP应用程序中是不必要的,因为ScrollViewer会自动对触摸操作做出反应。这就是为什么该属性不存在并且您会收到错误的原因。

    推荐文章