简体   繁体   English

如何将Windows Phone页面插入枢纽项目?

[英]How to insert windows phone page to pivot item?

I have a problem with Pivot control. 我对Pivot控件有问题。 How can I insert xaml page with content to Pivot item? 如何将带有内容的xaml页面插入到Pivot项目? Is it even possible? 可能吗?

When I'm storing everything in one file it's really hard to take control over my own application layout. 当我将所有内容存储在一个文件中时,很难控制自己的应用程序布局。

I want something like this: 我想要这样的东西:

  • on main page should be pivot control with items. 主页上的应该是带有项目的数据透视控件。
  • content of those items should be in separated xaml files (there is no dependency between pages) 这些项目的内容应放在单独的xaml文件中(页面之间没有依赖性)

Add correct namespace to Page: 向页面添加正确的名称空间:

xmlns:view="clr-namespace:YourApp.Controls"

and in Pivot: 并在Pivot中:

<Pivot>
   <PivotItem Name="first">
     <view:FirstUserControl DataContext="{Binding YourViewModel}"/>
   </PivotItem>
</Pivot>

And in view namespace you need to create a User Control . 并且在视图名称空间中,您需要创建一个用户控件 The link is about WPF but in WP7 there is the same system. 该链接与WPF有关,但是在WP7中有相同的系统。

Also, you can create Custom Control from PivotItem. 此外,您可以从PivotItem创建自定义控件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM