Skip to content

Instantly share code, notes, and snippets.

@prashantvc prashantvc/MyPage.xaml Secret
Last active Aug 29, 2015

What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="" xmlns:x="" x:Class="ToastApp.MyPage">
<Grid VerticalOptions="Start">
<RowDefinition Height="*" />
<RowDefinition Height="{Binding Path=ToolbarHeight,Mode=TwoWay}" />
<Button Text="Click" Command="{Binding Fire}"/>
<Label Grid.Row="1" Text="Hello there" BackgroundColor="Red" VerticalOptions="FillAndExpand"/>
using Xamarin.Forms;
using System.ComponentModel;
namespace ToastApp
public partial class MyPage : ContentPage
public MyPage ()
InitializeComponent ();
BindingContext = new MyViewModel ();
public class MyViewModel: INotifyPropertyChanged {
Command fire;
public Command Fire{
return fire ?? (fire = new Command (obj => ToolbarHeight = 200));
private GridLength toolbarHeight;
public GridLength ToolbarHeight {
get {
return toolbarHeight; // Never gets called
set {
toolbarHeight = value;
OnPropertyChanged ("ToolbarHeight");
protected void OnPropertyChanged (string propertyName){
var handler = PropertyChanged;
if (handler!=null) {
handler (this, new PropertyChangedEventArgs (propertyName));
#region INotifyPropertyChanged implementation
public event PropertyChangedEventHandler PropertyChanged;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.