包含在ScrollViewer中的GridView / ListView和查看状态更改(C#) [英] GridView / ListView wrapped in ScrollViewer and View State Changes (C#)

查看:72
本文介绍了包含在ScrollViewer中的GridView / ListView和查看状态更改(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题,找不到任何解决方法。 希望有人在这里......



我从VS中的网格应用程序模板开始创建了一个示例应用程序。 在GroupedItemsPage xaml文件中,我在GridView和ListView控件周围添加了一个ScrollViewer和Grid:

< ScrollViewer Grid.Row =" 1"名称= QUOT; TheScrollView" Style =" {StaticResource Horizo​​ntalScrollViewerStyle}"> 
< Grid>
< GridView>
<! - 此GridView的内容不会更改为默认值 - >
< / GridView>

< ListView>
<! - 此ListView的内容不会更改默认值 - >
< / ListView>
< / Grid>
< / ScrollViewer>

此外,在VisualStateManager的Storyboards中,我改变了ScrollViewer控件的样式:


在FullScreenPortrait中我添加

< ObjectAnimationUsingKeyFrames Storyboard.TargetName =" TheScrollView" Storyboard.TargetProperty = QUOT;样式和QUOT;> 
< DiscreteObjectKeyFrame KeyTime =" 0" Value =" {StaticResource Horizo​​ntalScrollViewerStyle}" />
< / ObjectAnimationUsingKeyFrames>

在Snapped中我添加

< ObjectAnimationUsingKeyFrames Storyboard.TargetName =" TheScrollView" Storyboard.TargetProperty = QUOT;样式和QUOT;> 
< DiscreteObjectKeyFrame KeyTime =" 0" Value =" {StaticResource VerticalScrollViewerStyle}" />
< / ObjectAnimationUsingKeyFrames>

样式更改按预期发生,滚动在水平和垂直之间切换。 但是,一旦用户从FullScreenLandscape切换到Snapped,然后将示例应用程序
返回拖到FullScreenLandscape,他们将无法再滚动分组网格视图的整个内容。 它切断了第三组的某个地方(第3组到第6组​​的一半在景观中无法到达)。 将
切换回Snapped后,所有组项目再次可见。



我知道在此示例中删除ScrollViewer是最佳的但是在我的实际项目中,控制是非常必要的。 有人有建议吗?



谢谢!!!

解决方案

< blockquote>没有人对这是否是一个缺陷有任何想法,或者是否有另一种方法在没有截断的情况下在ScrollViewer中包含GridView?


I've run into a problem and can't find any workaround.  Hopefully someone here has...

I've created a sample application starting from the Grid Application template in VS.  On the GroupedItemsPage xaml file, I've added a ScrollViewer and Grid around the GridView and ListView controls as such:

<ScrollViewer Grid.Row="1" Name="TheScrollView" Style="{StaticResource HorizontalScrollViewerStyle}">
    <Grid>
        <GridView>
            <!-- The content of this GridView does not change from the default -->
        </GridView>

        <ListView>
            <!-- The content of this ListView does not change from the default -->
        </ListView>
    </Grid>
</ScrollViewer>

Also, in the VisualStateManager's Storyboards, I change the style of the ScrollViewer control as such:

In FullScreenPortrait I add

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TheScrollView" Storyboard.TargetProperty="Style">
    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HorizontalScrollViewerStyle}"/>
</ObjectAnimationUsingKeyFrames>

And in Snapped I add

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TheScrollView" Storyboard.TargetProperty="Style">
    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource VerticalScrollViewerStyle}"/>
</ObjectAnimationUsingKeyFrames>

The style changes happen as expected and scrolling switches between horizontal and vertical.  However, once the user switches from FullScreenLandscape to Snapped and then drags the sample application back to FullScreenLandscape, they are no longer able to scroll the entire content of the Grouped Grid View.  It cuts off somewhere in the third Group (leaving half of Group 3 through Group 6 unreachable in Landscape).  After switching back to Snapped, all group items are visible again.

I know that removing the ScrollViewer in this example is optimal, however in my actual project the control is annoyingly necessary.  Anyone have a suggestion?

Thanks!!!

解决方案

No one has any ideas about whether this is a defect or if there is another way to contain a GridView inside a ScrollViewer without the truncation?


这篇关于包含在ScrollViewer中的GridView / ListView和查看状态更改(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆