protected override Control CreateControl(DirectBinding <byte> keyBinding, DirectBinding <string> valueBinding) { var keyBox = new IntegerNumberBox(); keyBox.ValueBinding.Bind(keyBinding.Convert( b => (int)b, i => (byte)i )); keyBox.TextChanging += (sender, e) => e.Cancel = byte.TryParse(e.NewText, out byte newByte) && ItemSource.Keys.Contains(newByte); var valueBox = new TextBox(); valueBox.TextBinding.Bind(valueBinding); return(new StackLayout { Orientation = Orientation.Horizontal, Padding = new Padding(0, 0, 5, 0), Spacing = 5, Items = { keyBox, new StackLayoutItem(valueBox, true) } }); }
protected override Control CreateControl(int index, DirectBinding <byte> itemBinding) { MaskedTextBox <int> intBox = new IntegerNumberBox(); intBox.ValueBinding.Bind( itemBinding.Convert <int>( c => (int)c, v => (byte)v ) ); return(new Panel { Padding = new Padding(0, 0, 5, 0), Content = intBox }); }