protected override void OnButtonPressed(ButtonEventArgs args) { if (args.Button == PointerButton.Left) { if (!this.isreadonly && !this.editmode)// && !(this.item is GridItemRoot)) { if (!this.owner.EditMode || this.owner.CancelEdit(true)) { this.editmode = true; var value = owner.GetValue(this.item); if (this.item.TypeConverter.GetStandardValuesSupported(this.item as ITypeDescriptorContext)) { bool stdvaluesexclusive = this.item.TypeConverter.GetStandardValuesExclusive(); this.cbinput = this.isreadonly || stdvaluesexclusive ? new ComboBox() : new ComboBoxEntry(); var stdvalues = this.item.TypeConverter.GetStandardValues(this.item as ITypeDescriptorContext).Cast <object>().ToArray(); foreach (var stdvalue in stdvalues) { var stdtxt = (stdvalue.GetType().GetCustomAttributes(typeof(DisplayNameAttribute), true).FirstOrDefault() as DisplayNameAttribute)?.DisplayName ?? item.TypeConverter.ConvertToString(item as ITypeDescriptorContext, stdvalue); this.cbinput.Items.Add(new comboitem(stdvalue, stdtxt)); } var sel = this.cbinput.Items.Cast <comboitem>().FirstOrDefault(_i => object.Equals(value, _i.value)); this.cbinput.SelectedItem = sel; if (this.cbinput is ComboBoxEntry) { (this.cbinput as ComboBoxEntry).TextEntry.TextAlignment = Alignment.Start; (this.cbinput as ComboBoxEntry).TextEntry.Text = sel?.text ?? ""; (this.cbinput as ComboBoxEntry).TextEntry.Changed += cbinput_textchanged; } cbinput.SelectionChanged += Cbinput_SelectionChanged; this.AddChild(this.cbinput); this.SetChildBounds(this.cbinput, this.Bounds); } else { var text = item.TypeConverter?.ConvertToString(item as ITypeDescriptorContext, value) ?? value?.ToString(); this.txtinput = new TextEntry() { Text = text, ExpandHorizontal = true }; this.AddChild(this.txtinput); this.SetChildBounds(this.txtinput, this.Bounds); } QueueDraw(); args.Handled = true; return; } } } base.OnButtonPressed(args); }