Windows Phone ScrollViewer 在应用投影时不起作用



我在真实的复杂项目中发现了这个问题,但它可以在简单的测试项目中重现。所以我有测试UWP页面

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid
            VerticalAlignment="Top"
            HorizontalAlignment="Left"
            Height="100">
            <Grid.Projection>
                <PlaneProjection GlobalOffsetY="100"/>
            </Grid.Projection>
            <ScrollViewer
                VerticalScrollMode="Enabled"
                VerticalScrollBarVisibility="Visible">
                <StackPanel>
                    <Button Content="1"/>
                    <Button Content="2"/>
                    <Button Content="3"/>
                    <Button Content="4"/>
                    <Button Content="5"/>
                    <Button Content="6"/>
                    <Button Content="7"/>
                </StackPanel>
            </ScrollViewer>
        </Grid>
    </Grid>

它在PC版本中可以正常工作,但滚动条在手机(windowsphone(版本中不起作用。Windows Phone 8.1也是如此如果要在父网格上评论投影-一切都好。

有解决这个问题的想法吗?

它在PC版本中可以正常工作,但滚动条在手机(windowsphone(版本中不起作用。

根据设计,如果scrollviewer的全局变换(此处为投影变换(不能表示为矩阵变换,则不能使用处理触摸交互的底层。

因此,如果您只需要应用GlobalOffsetYGlobalOffsetX。我建议您改用TranslateTransform。它不会阻止ScrollViewer滚动:

<Grid
    VerticalAlignment="Top"
    HorizontalAlignment="Left"
    Height="500" Width="200">
    <Grid.RenderTransform>
        <TranslateTransform Y="100"/>
    </Grid.RenderTransform>
    <ScrollViewer
        VerticalScrollMode="Enabled"
        VerticalScrollBarVisibility="Visible">
        <StackPanel>
            <Button Content="1"/>
            <Button Content="2"/>
            <Button Content="3"/>
            <Button Content="4"/>
            <Button Content="5"/>
            <Button Content="6"/>
            <Button Content="7"/>
        </StackPanel>
    </ScrollViewer>
</Grid>

最新更新