制作的StackPanel在Windows Phone 8的滚动 [英] Making a StackPanel scrollable in Windows Phone 8

查看:148
本文介绍了制作的StackPanel在Windows Phone 8的滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表控件,放入的StackPanel。这些控件是Hubtiles,被编程添加一个用户创建后 - 名单基本上是。我需要在其中添加,滚动的StackPanel的 - 这将是我们的最佳方法呢?我应该把StackPanel的一个滚动型里面,然后增加StackPanels高度与Hubtile的实际高度 - 使其滚动的,但不是这样,用户可以在没有东西在那里滚动无限的。所以每当控件的StackPanel的内量达到3,它会自动增加它的高度是这样的:

I have a list of controls, put into a stackpanel. These controls are Hubtiles, that are added programatically after a user creates it - a list essentially. I need to make the StackPanel in which they are added, scrollable - what would be the best approach for this? Should i put the stackpanel inside a ScrollView, and then increase the StackPanels height with the actual height of the Hubtile - to make it scrollable, but not so that the user can scroll infinite without something being there. So whenever the amount of controls inside the StackPanel reaches 3, it'll automatically increase it's height like this:

每当控制的StackPanel内量达到3个或以上:

Whenever the amount of controls inside the StackPanel reaches 3 or above:

StackPanel.Height = StackPanel.Height + Hubtile.ActualHeight;



非常感谢!

Thanks a lot!

推荐答案

只是把进入的StackPanel的ScrollViewer ,设置StackPanel.VerticalAlignment伸展和设置固定大小父的ScrollViewer。这是必要的 - 在ScrollViewer中必须知道它的大小,显示滚动条时,对于内部内容太长内部内容。

Just put the StackPanel into ScrollViewer, set the StackPanel.VerticalAlignment to Stretch and set fixed size to the parent ScrollViewer. This is necessary - the ScrollViewer must know its size, to show the scrollbars for the inner content when the inner content is too long.

这篇关于制作的StackPanel在Windows Phone 8的滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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