コード例 #1
0
ファイル: SpinButton.cs プロジェクト: communityus-branch/Myra
        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;
        }
コード例 #2
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;
        }
コード例 #3
0
ファイル: SpinButton.cs プロジェクト: DadeKuma/Myra
        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);
            }
        }
コード例 #4
0
 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;
 }
コード例 #5
0
ファイル: SpinButtonStyle.cs プロジェクト: dstiert/Myra
 public SpinButtonStyle(SpinButtonStyle style) : base(style)
 {
     UpButtonStyle   = new ImageButtonStyle(style.UpButtonStyle);
     DownButtonStyle = new ImageButtonStyle(style.DownButtonStyle);
     TextFieldStyle  = new TextFieldStyle(style.TextFieldStyle);
 }