简体   繁体   中英

How to insert windows phone page to pivot item?

I have a problem with Pivot control. How can I insert xaml page with content to Pivot item? 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)

Add correct namespace to Page:

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

and in 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.

Also, you can create Custom Control from PivotItem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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