Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Using Xamarin Forms without Navigation Page

$
0
0

HI,

I'm trying to set up a project that uses a mix of Xamarin Forms pages and standard Android Activities. As a part of this, I planned to use my own navigation system.

Similar to this post, I can't seem to just open a plain content page.

// This Fails

[Activity(Label = "MyApp", MainLauncher = false)]
public class XamFormsActivity : AndroidActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        Xamarin.Forms.Forms.Init(this, bundle);
        SetPage(new ContentPage());
    }
}

// This works.... but is using the unwanted NavigationPage
[Activity(Label = "TeenStar", MainLauncher = false)]
public class XamFormsActivity : AndroidActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Xamarin.Forms.Forms.Init(this, bundle);

        var navPage = new NavigationPage(new ContentPage());
        NavigationPage.SetHasNavigationBar(navPage, false);
        var startPage = StaticFunctions.TopPage()
            .ContinueWith((p) => 
            {
                navPage.Navigation.PushAsync(p.Result);

            }, TaskScheduler.FromCurrentSynchronizationContext());
        SetPage(navPage);
    }
}

I've had a look at the Xuzzle sample, which seems to do exactly what I'm after. Is it perhaps because my activity isn't the main launcher?

What is best practice for intermingling xam forms with other pages?

I've attached the crash log.

Thanks in advance.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>