public SpinButton(SpinButtonStyle style) { AcceptsKeyboardFocus = AcceptsMouseWheelFocus = true; InternalChild = new Grid(); HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Top; InternalChild.ColumnsProportions.Add(new Proportion(ProportionType.Fill)); InternalChild.ColumnsProportions.Add(new Proportion()); InternalChild.RowsProportions.Add(new Proportion()); InternalChild.RowsProportions.Add(new Proportion()); _textField = new TextField { GridRowSpan = 2, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, InputFilter = InputFilter, TextVerticalAlignment = VerticalAlignment.Center }; _textField.TextChanged += TextFieldOnTextChanged; _textField.TextChangedByUser += TextFieldOnTextChangedByUser; InternalChild.Widgets.Add(_textField); _upButton = new ImageButton { GridColumn = 1, ContentVerticalAlignment = VerticalAlignment.Center, ContentHorizontalAlignment = HorizontalAlignment.Center }; _upButton.Click += UpButtonOnUp; InternalChild.Widgets.Add(_upButton); _downButton = new ImageButton { GridColumn = 1, GridRow = 1, ContentVerticalAlignment = VerticalAlignment.Center, ContentHorizontalAlignment = HorizontalAlignment.Center }; _downButton.Click += DownButtonOnUp; InternalChild.Widgets.Add(_downButton); if (style != null) { ApplySpinButtonStyle(style); } Value = 0; }
public SpinButton(SpinButtonStyle style) : base(style) { HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Top; ColumnsProportions.Add(new Proportion(ProportionType.Fill)); ColumnsProportions.Add(new Proportion()); RowsProportions.Add(new Proportion()); RowsProportions.Add(new Proportion()); _textField = new TextField { GridSpanY = 2, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, InputFilter = InputFilter }; _textField.TextChanged += TextFieldOnTextChanged; _textField.TextChangedByUser += TextFieldOnTextChangedByUser; Widgets.Add(_textField); _upButton = new ImageButton { GridPositionX = 1, ContentVerticalAlignment = VerticalAlignment.Center, ContentHorizontalAlignment = HorizontalAlignment.Center }; _upButton.Up += UpButtonOnUp; Widgets.Add(_upButton); _downButton = new ImageButton { GridPositionX = 1, GridPositionY = 1, ContentVerticalAlignment = VerticalAlignment.Center, ContentHorizontalAlignment = HorizontalAlignment.Center }; _downButton.Up += DownButtonOnUp; Widgets.Add(_downButton); if (style != null) { ApplySpinButtonStyle(style); } Value = 0; }
public void ApplySpinButtonStyle(SpinButtonStyle style) { ApplyWidgetStyle(style); if (style.TextBoxStyle != null) { _textField.ApplyTextBoxStyle(style.TextBoxStyle); } if (style.UpButtonStyle != null) { _upButton.ApplyImageButtonStyle(style.UpButtonStyle); } if (style.DownButtonStyle != null) { _downButton.ApplyImageButtonStyle(style.DownButtonStyle); } }
public SpinButtonStyle(SpinButtonStyle style) : base(style) { UpButtonStyle = style.UpButtonStyle != null ? new ImageButtonStyle(style.UpButtonStyle) : null; DownButtonStyle = style.DownButtonStyle != null ? new ImageButtonStyle(style.DownButtonStyle) : null; TextFieldStyle = style.TextFieldStyle != null ? new TextFieldStyle(style.TextFieldStyle) : null; }
public SpinButtonStyle(SpinButtonStyle style) : base(style) { UpButtonStyle = new ImageButtonStyle(style.UpButtonStyle); DownButtonStyle = new ImageButtonStyle(style.DownButtonStyle); TextFieldStyle = new TextFieldStyle(style.TextFieldStyle); }