private Control CreatePropertyControl(ListProperty property) { Type type = property.UnderlyingType; BindListAttribute listAttribute = type.GetCustomAttribute <BindListAttribute>(); listAttribute ??= property.PropertyInfo.GetCustomAttribute <BindListAttribute>(); Control control = null; if (type == typeof(bool)) { control = new TabControlCheckBox(property); } else if (type.IsEnum || listAttribute != null) { control = new TabControlComboBox(property, listAttribute); } else if (typeof(DateTime).IsAssignableFrom(type)) { control = new TabDateTimePicker(property); } else if (!typeof(IList).IsAssignableFrom(type)) { control = new TabControlTextBox(property); } return(control); }
private void AddTimeTextBox() { _timeTextBox = new TabControlTextBox() { IsReadOnly = !Property.Editable, Watermark = "15:30:45", Margin = new Thickness(8, 0, 0, 0), MinWidth = 75, MaxWidth = 300, Focusable = true, // already set? [Grid.ColumnProperty] = 1, }; if (!Property.Editable) { _timeTextBox.Background = Theme.TextBackgroundDisabled; } _timeTextBox.Bind(TextBlock.TextProperty, Binding); Children.Add(_timeTextBox); }