protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (Control != null) { var ctrl = e.NewElement as IEbCustomControl; drawable.SetShape(ShapeType.Rectangle); drawable.SetCornerRadius(ctrl.BorderRadius); if (ctrl.BorderColor != null) { drawable.SetStroke(ctrl.BorderThickness, ctrl.BorderColor.ToAndroid()); } if (ctrl.XBackgroundColor != null) { drawable.SetColor(ctrl.XBackgroundColor.ToAndroid()); } Control.SetBackground(drawable); EbXNumericTextBox textbox = e.NewElement as EbXNumericTextBox; if (textbox.EnableFocus) { textbox.Focused += Textbox_Focused; textbox.Unfocused += Textbox_Unfocused; } } }
public override View Draw(FormMode Mode, NetworkMode Network) { decimalPadding = this.DecimalPlaces > 0 ? ".".PadRight(this.DecimalPlaces + 1, '0') : string.Empty; if (RenderType == NumericBoxTypes.ButtonType) { Grid grid = new Grid { ColumnSpacing = 4, IsEnabled = !this.ReadOnly }; if (this.IncrementButtons == null || this.IncrementButtons.Count == 0) { this.IncrementButtons = new List <EbMobileNumBoxButtons>() { new EbMobileNumBoxButtons() { Value = -1 }, new EbMobileNumBoxButtons() { Value = 1 } } } ; this.IncrementButtons = this.IncrementButtons.OrderBy(e => e.Value).ToList(); Int16 index = 0; foreach (EbMobileNumBoxButtons btn in this.IncrementButtons) { if (btn.Value > 0) { break; } this.AddIncrButton(grid, btn.Value, index++, "- "); } grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); XValueBox = new EbXTextBox { Text = this.MinLimit + decimalPadding, Keyboard = Keyboard.Numeric, HorizontalTextAlignment = TextAlignment.Center, IsReadOnly = this.ReadOnly, XBackgroundColor = this.XBackground, EnableFocus = true, BorderOnFocus = App.Settings.Vendor.GetPrimaryColor() }; XValueBox.TextChanged += this.NumericValueChanged; XValueBox.Focused += this.OnFocused; XValueBox.Unfocused += this.OnUnFocused; grid.Children.Add(XValueBox, index++, 0); foreach (EbMobileNumBoxButtons btn in this.IncrementButtons) { if (btn.Value < 0) { continue; } this.AddIncrButton(grid, btn.Value, index++, "+ "); } this.XControl = grid; } else { EbXNumericTextBox numeric = new EbXNumericTextBox { Text = "0" + decimalPadding, IsReadOnly = this.ReadOnly, XBackgroundColor = this.XBackground, Keyboard = Keyboard.Numeric, Behaviors = { new NumericBoxBehavior() }, EnableFocus = true, BorderOnFocus = App.Settings.Vendor.GetPrimaryColor(), HorizontalTextAlignment = TextAlignment.End }; numeric.TextChanged += this.NumericValueChanged; numeric.Focused += this.OnFocused; numeric.Unfocused += this.OnUnFocused; this.XControl = numeric; } return(base.Draw(Mode, Network)); }