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

blank content page while adding toolbar

$
0
0

I am trying to add toolbar items to content page.
I am using VS 2012 for development. Though this is basic, i am not sure, why i am not able to see it on device.

public partial class SamplePage : ContentPage
{
public SamplePage()
{
//Toolbar items
ToolbarItem scanItem = new ToolbarItem ();
scanItem.Name = "Scan";
scanItem.Order = ToolbarItemOrder.Primary;

        ToolbarItem settingsItem = new ToolbarItem ();
        settingsItem.Name = "Settings";
        settingsItem.Order = ToolbarItemOrder.Primary;

        ToolbarItems.Add (scanItem);
        ToolbarItems.Add (settingsItem);
}

}
App.cs

public class App
{
public static Page GetMainPage ()
{
return new NavigationPage(new SamplePage ());
}
}
Tried xaml way of doing it as well. But no result. Content page is blank.

<?xml version="1.0" encoding="UTF-8"?>

<ContentPage.Content>
</ContentPage.Content>
<ContentPage.ToolbarItems>


</ContentPage.ToolbarItems>


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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