Skip to content

Instantly share code, notes, and snippets.

@dbeattie71
Created April 25, 2015 23:41
Show Gist options
  • Select an option

  • Save dbeattie71/4f7c442d8bd1856f366e to your computer and use it in GitHub Desktop.

Select an option

Save dbeattie71/4f7c442d8bd1856f366e to your computer and use it in GitHub Desktop.
Xamarin Forms customcell binding example
public class EditorCell : ViewCell
{
public static readonly BindableProperty TextProperty = BindableProperty.Create<EditorCell, string>(p => p.Text, null, BindingMode.TwoWay);
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public EditorCell()
{
var editor = new Editor();
View = editor;
editor.BindingContext = this;
editor.SetBinding(Editor.TextProperty, (EditorCell ec) => ec.Text, BindingMode.TwoWay);
editor.SetBinding(Editor.HeightRequestProperty, (EditorCell ec) => ec.Height, BindingMode.OneWay);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment