如何在同一时间与Xamarin.Forms创建一个屏幕上的多个内容网页,平板电脑的用户界面? [英] How to create a tablet UI with multiple ContentPages on one screen at the same time with Xamarin.Forms?

查看:592
本文介绍了如何在同一时间与Xamarin.Forms创建一个屏幕上的多个内容网页,平板电脑的用户界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个 UI 平板电脑(的Andr​​oid &放大器; 的iOS )使用 Xamarin.Forms 在这里我想有多个内容网页在一个屏幕上。我知道如何使用片段(据我所知为的iOS 的Andr​​oid C $ C>是 UISplitViewController )。

I want to design a UI for tablets (Android & iOS) with Xamarin.Forms where I want to have multiple ContentPages on one screen. I know how to achieve this for Android by using Fragments (afaik for iOS it's UISplitViewController).

我如何与 Xamarin.Forms 实现这一目标?

How can I achieve this with Xamarin.Forms?

P.S。我绝对不希望有一个 TabbedPage

P.s. I definitely don't want a TabbedPage!

推荐答案

据我所知,你不能把多个ContentPage项目在屏幕上,至少外的现成的Xamarin.Forms不中。

As far as I know you can't put multiple ContentPage items on the screen, at least not within the out-of-the-box Xamarin.Forms.

您可以,但是,把屏幕上的多个内容查看项目和可以重复使用的独立页面的内容查看的项目也是如此。

You can, however, put multiple ContentView items on the screen and you can reuse the ContentView items in stand-alone pages as well.

从本质上讲,你能描述你想要看到一个页面上作为一个内容查看什么,然后做一个网页,只是包括

Essentially you can describe what you'd want to see on a single page as a ContentView and then make a page that just includes that

PhotoItem.xaml:

PhotoItem.xaml:

<ContentView>
   <Grid>
     <Image Source="{Binding MyImageSource}"/>
   </Grid>
</ContentView>

PhotoBucket.xaml:

PhotoBucket.xaml:

<ContentPage xmlns:local="namespace;assembly">
  <ContentPage.Content>
    <OnIdiom x:TypeArguments="View">
     <OnIdiom.Phone>
       <ListView>
          ... on list item tap do Navigation.PushAsync(new PhotoItemPage{BindingContext = itemTapped} );
       </ListView>
      </OnIdiom.Phone>
     <OnIdiom.Tablet>
       <Grid> // Add two columns
         <ListView Grid.Column="0">
            ... on list item tap do PhotoItem.BindingContext = itemTapped
         </ListView>
         <local:PhotoItem Grid.Column="1"/>
      </OnIdiom.Tablet>
    </OnIdiom>
  </ContentPage.Content> 
</ContentPage>

PhotoItemPage.xaml:

PhotoItemPage.xaml:

<ContentPage xmlns:local="namespace;assembly">
   <local:PhotoItem>
</ContentPage>

这篇关于如何在同一时间与Xamarin.Forms创建一个屏幕上的多个内容网页,平板电脑的用户界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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