Created
April 25, 2015 23:41
-
-
Save dbeattie71/4f7c442d8bd1856f366e to your computer and use it in GitHub Desktop.
Xamarin Forms customcell binding example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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