在Windows 8中使用不同的控件创建中心页 [英] Creating hub page with different controls in Windows 8
问题描述
您看到的最多登陆/中心页面只是一个 GroupedGridView (例如实际的市场应用)
The most landing/hub pages you see are just a GroupedGridView ( for example the actual marketplace app )
但是我希望有一个带有不同控件的分组中心页面.
But I would like to have a Grouped hub page with different controls.
例如,我的第一个控件是包含某些类别的ListView. 第二个控件和第三个控件是GridViews,其中包含多个项目.
For example my first control is a ListView that contains some categories. 2nd and 3th control are GridViews with several items in them.
如果所有3个控件都是GridViews,我可以很容易地使它工作,但事实并非如此.
If all 3 controls were GridViews I could easily get this working but it's not.
我似乎找不到ScrollViewer与Grid或Stackpanel的有效组合来获得实际的完整水平滚动效果.
I can't seem to find a working combination of ScrollViewer with a Grid or Stackpanel to get the actual full Horizontal Scrolling working.
关于如何在一个水平页面中创建具有不同控件的登陆/集线页面的想法或示例吗?
Any idea's or examples on how to create such a landing/hub page with different controls in one horizontal page?
推荐答案
您可以使用未分组的GridView,其中每个项目将是使用不同的DataTemplate显示的不同控件.
You can use an GridView that is not grouped where each item will be a different control displayed using a different DataTemplate.
或者您可以欺骗FlipView以使其表现为Windows Phone的Panorama控件.有关详细信息,请参见 http://dotnetbyexample.blogspot .cz/2012/08/a-winrt-behavior-to-turn-flipview-into.html
Or you can trick the FlipView to behave like a Panorama control for Windows Phone. Details at http://dotnetbyexample.blogspot.cz/2012/08/a-winrt-behavior-to-turn-flipview-into.html
编辑: 对于第一个解决方案,您创建一个基类,并创建一个列表,其中包含从该基类派生的不同对象.然后,使用GridView的ItemTemplaceSelector选择一个合适的DataTemplate.参见 http://coding.kulman .sk/using-different-data-templates-with-gridview-in-windows-8-apps/
EDIT: For the first solution you create a base class and create a list with your different objects derived from the base class. Then you use the GridView's ItemTemplaceSelector to select a select an appropriate DataTemplate. See http://coding.kulman.sk/using-different-data-templates-with-gridview-in-windows-8-apps/
这篇关于在Windows 8中使用不同的控件创建中心页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!