XamarinForms页面类型 [英] XamarinForms Pagetypes

查看:85
本文介绍了XamarinForms页面类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从XamarinForms开始.我想创建外观与Facebook Messanger相似的应用程序.重点是我在寻找提示,如何使用按钮导航整个视图.

I am starting with XamarinForms. I would like to create application which look line Facebook Messanger. The points is I am looking for tip how to achive bottom bar with buttons to navigate throught views.

我试图用CarouselPage来做,但是我看不到制作静态底部栏的选项.如我所见,CarouselPage只能包含ContentPages的集合

I was trying to do it with CarouselPage but I dont see option to make static bottom bar. As I see CarouselPage can only contain collection of ContentPages

<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:xxx"
             x:Name="ThisPage"
             x:Class="xxx">
    <ContentPage>
        <ContentPage.Content>
            <Grid>

            </Grid>
        </ContentPage.Content>
    </ContentPage>
    <ContentPage>
        <ContentPage.Content>
            <Grid>
                <Label Text="Page1"></Label>
            </Grid>
        </ContentPage.Content>
    </ContentPage>
    <ContentPage>
        <ContentPage.Content>
            <Grid>
                <Label Text="Page2"></Label>
            </Grid>
        </ContentPage.Content>
    </ContentPage>

</CarouselPage>

我也确实尽力使它成为XAML中的可能-在底部使用导航按钮创建stacklayout,并在其余页面上创建内容演示者,并动态地更改其内容,但是它没有按预期工作.

I did also try to make it as it was possible in XAML - create stacklayout at the bottom with navigation buttons and create content presenter to the rest page and dymanically change his content but it did not work as expected.

有人可以给我小费吗?:)

Can someone give me any tip ?:)

推荐答案

我认为您有很多方法可以做到这一点.我没有使用Fb Messenger(抱歉),但是我对您的需求有所了解.

I think you have many ways to do it. I don't use Fb Messenger (sorry) but I have an idea of what you need.

  • 首先,我想提醒您,"TabbedPage"将在iOS上为您提供此底部栏,但在Android上将排在顶部...

  • First I will remind you that a "TabbedPage" will give give you this bottom bar on iOS but will be on the top for Android...

接下来,您可以使用第三方组件.我认为我过去已经看过好几次了(例如,如果您使用'DuckDuckGo''xamarin Forms bottom bar',您应该会发现一些好东西.例如,您可以尝试使用此方法,使Android的底部条效果很好(并且适用于iOS的本机栏): Github BottomNavigationBarXF .

Next, you can use a third party component. I've already seen several in the past I think (If you 'DuckDuckGo' 'xamarin forms bottom bar' for instance you should find good things. You can try this one for example that renders the bottom bar on Android pretty well (and the native bar for iOS): Github BottomNavigationBarXF.

最后,您提到了它,您可以尝试制作自己的导航栏.如果您具有一些设计技能,这应该并不困难.使您的底部栏控件接受导航按钮",然后更改"ContentPresenter.Content"属性(在拥有底部栏的页面中)以响应按钮的单击...

Finally, has you mentionned it, you can try to make your own navigation bar. It should not be difficult if you have some design skills. Make your bottom bar control that accepts "navigation buttons", then change the 'ContentPresenter.Content' property (in the page that owns your bottom bar) in response of the button clicks...

Github项目(BottomBarNavigationXF)的示例: (Android)(iOS)

Exemple of the Github project (BottomBarNavigationXF): (Android) (iOS)

如果这是您要找的内容,请告诉我,或者如果您可以,请标记为已回答!

Tell me if it's what you was looking for, or mark as answered if it's ok for you !

这篇关于XamarinForms页面类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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