Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created February 17, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prashantvc/0688add6e6e220d1b741 to your computer and use it in GitHub Desktop.
Save prashantvc/0688add6e6e220d1b741 to your computer and use it in GitHub Desktop.
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