Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created Feb 17, 2015
Embed
What would you like to do?
using Xamarin.Forms;
using System.Diagnostics;
namespace TBTest
{
public class App : Application
{
public App ()
{
// The root page of your application
var contentPage = new ContentPage {
Content = new StackLayout {
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
XAlign = TextAlignment.Center,
Text = "Welcome to Xamarin Forms!"
}
}
}
};
contentPage.ToolbarItems.Add (
new ToolbarItem { Text = "One", Order = ToolbarItemOrder.Primary }
);
var enabledButton = new ToolbarItem { Text = "Enabled", Order = ToolbarItemOrder.Secondary,
Command = new Command (() => Debug.WriteLine ("Enabled Button Clicked"), () => true)};
var disabledButton = new ToolbarItem { Text = "Disabled", Order = ToolbarItemOrder.Secondary,
Command = new Command (() => Debug.WriteLine ("Disabled Button Clicked"), () => false)};
contentPage.ToolbarItems.Add (enabledButton);
contentPage.ToolbarItems.Add (disabledButton);
MainPage = new NavigationPage (contentPage);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment