Exemple #1
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.layout             = new BoxLayout();
     this.layout.Orientation = Orientation.Vertical;
     this.Children.Add((RadElement)this.layout);
     this.arrowButtonUp = new RadRepeatArrowElement();
     this.arrowButtonUp.StretchVertically = false;
     this.arrowButtonUp.Direction         = Telerik.WinControls.ArrowDirection.Up;
     this.arrowButtonUp.Border.Visibility = ElementVisibility.Hidden;
     this.arrowButtonUp.Size = new Size(10, 6);
     this.layout.Children.Add((RadElement)this.arrowButtonUp);
     this.arrowButtonUp.BorderThickness = new Padding(0);
     this.arrowButtonDown = new RadRepeatArrowElement();
     this.arrowButtonDown.StretchVertically = false;
     this.arrowButtonDown.Direction         = Telerik.WinControls.ArrowDirection.Down;
     this.arrowButtonDown.Border.Visibility = ElementVisibility.Hidden;
     this.arrowButtonDown.Size = new Size(10, 6);
     this.layout.Children.Add((RadElement)this.arrowButtonDown);
     this.arrowButtonDown.BorderThickness = new Padding(0);
 }
Exemple #2
0
        protected override void CreateChildElements()
        {
            this.buttonUp                     = this.CreateUpButton();
            this.buttonDown                   = this.CreateDownButton();
            this.textItem                     = new RadTextBoxItem();
            this.textItem.Alignment           = ContentAlignment.MiddleLeft;
            this.textItem.StretchHorizontally = true;
            this.textItem.StretchVertically   = false;
            int num1 = (int)this.textItem.BindProperty(TextPrimitive.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.TwoWay);
            int num2 = (int)this.textItem.BindProperty(RadElement.ContainsMouseProperty, (RadObject)this, RadElement.ContainsMouseProperty, PropertyBindingOptions.TwoWay);

            this.textItem.Multiline     = false;
            this.textItem.RouteMessages = false;
            this.layout       = new StackLayoutElement();
            this.layout.Class = "SpinElementLayout";
            this.layout.StretchHorizontally          = true;
            this.layout.StretchVertically            = true;
            this.layout.FitInAvailableSize           = true;
            this.textBoxFillPrimitive                = new FillPrimitive();
            this.textBoxFillPrimitive.Class          = "SpinElementFill";
            this.textBoxFillPrimitive.NumberOfColors = 1;
            this.border                            = new BorderPrimitive();
            this.border.Class                      = "SpinElementBorder";
            this.buttonsLayout                     = new StackLayoutElement();
            this.buttonsLayout.Orientation         = Orientation.Vertical;
            this.buttonsLayout.StretchHorizontally = false;
            this.buttonsLayout.StretchVertically   = true;
            this.buttonsLayout.FitInAvailableSize  = true;
            this.buttonsLayout.Class               = "ButtonsLayout";
            this.buttonsLayout.Children.Add((RadElement)this.buttonUp);
            this.buttonsLayout.Children.Add((RadElement)this.buttonDown);
            this.layout.Children.Add((RadElement)this.textItem);
            this.layout.Children.Add((RadElement)this.buttonsLayout);
            this.Children.Add((RadElement)this.textBoxFillPrimitive);
            this.Children.Add((RadElement)this.border);
            this.Children.Add((RadElement)this.layout);
            this.SetSpinValue(this.internalValue, true);
            this.WireEvents();
        }
Exemple #3
0
 protected virtual void CreateSpinButtons()
 {
     this.spinButtonsStackLayout                     = new StackLayoutElement();
     this.spinButtonsStackLayout.Orientation         = Orientation.Vertical;
     this.spinButtonsStackLayout.StretchVertically   = true;
     this.spinButtonsStackLayout.StretchHorizontally = false;
     this.spinButtonsStackLayout.FitInAvailableSize  = true;
     this.spinButtonsStackLayout.Class               = "ButtonsLayout";
     this.layout.Children.Add((RadElement)this.spinButtonsStackLayout);
     this.buttonUp                     = this.CreateUpButton();
     this.buttonUp.Click              += new EventHandler(this.buttonUp_Click);
     this.buttonUp.DoubleClick        += new EventHandler(this.buttonUp_Click);
     this.buttonUp.StretchHorizontally = false;
     this.buttonUp.StretchVertically   = true;
     this.buttonUp.Direction           = Telerik.WinControls.ArrowDirection.Up;
     this.spinButtonsStackLayout.Children.Add((RadElement)this.buttonUp);
     this.buttonDown                     = this.CreateDownButton();
     this.buttonDown.Click              += new EventHandler(this.buttonDown_Click);
     this.buttonDown.DoubleClick        += new EventHandler(this.buttonDown_Click);
     this.buttonDown.StretchVertically   = true;
     this.buttonDown.StretchHorizontally = false;
     this.buttonDown.Direction           = Telerik.WinControls.ArrowDirection.Down;
     this.spinButtonsStackLayout.Children.Add((RadElement)this.buttonDown);
 }
Exemple #4
0
        public override void CreateChildren()
        {
            this.backGround       = new FillPrimitive();
            this.backGround.Class = "DateTimePickerBackGround";
            int num1 = (int)this.backGround.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);

            this.dateTimePickerElement.Children.Add((RadElement)this.backGround);
            this.border       = new BorderPrimitive();
            this.border.Class = "DateTimePickerBorder";
            this.dateTimePickerElement.Children.Add((RadElement)this.border);
            this.stackLayout = new StackLayoutElement();
            int num2 = (int)this.stackLayout.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)true);
            int num3 = (int)this.stackLayout.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);

            this.stackLayout.FitInAvailableSize = true;
            this.stackLayout.Class = "DateTimePickerSpinLayout";
            this.dateTimePickerElement.Children.Add((RadElement)this.stackLayout);
            this.checkBox = new RadCheckBoxElement();
            int num4 = (int)this.checkBox.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num5 = (int)this.checkBox.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num6 = (int)this.checkBox.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleCenter);

            if (!this.dateTimePickerElement.ShowCheckBox)
            {
                this.checkBox.Visibility = ElementVisibility.Collapsed;
            }
            this.stackLayout.Children.Add((RadElement)this.checkBox);
            this.dateTimePickerElement.CheckBox = this.checkBox;
            this.textBoxElement = new RadMaskedEditBoxElement();
            this.textBoxElement.MaskProviderCreated += new EventHandler(this.textBoxElement_MaskProviderCreated);
            this.textBoxElement.Mask       = "";
            this.textBoxElement.MaskType   = MaskType.DateTime;
            this.textBoxElement.ShowBorder = false;
            this.textBoxElement.Class      = "textbox";
            this.textBoxElement.ThemeRole  = "DateTimePickerMaskTextBoxElement";
            int num7  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);
            int num8  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)true);
            int num9  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num10 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);
            int num11 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)false);
            int num12 = (int)this.textBoxElement.Fill.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);

            this.textBoxElement.TextBoxItem.HostedControl.RightToLeft = this.dateTimePickerElement.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
            this.stackLayout.Children.Add((RadElement)this.textBoxElement);
            this.textBoxElement.Children[this.textBoxElement.Children.Count - 1].Visibility = ElementVisibility.Collapsed;
            this.textBoxElement.KeyDown                 += new KeyEventHandler(this.textBoxElement_KeyDown);
            this.textBoxElement.KeyPress                += new KeyPressEventHandler(this.textBoxElement_KeyPress);
            this.textBoxElement.KeyUp                   += new KeyEventHandler(this.textBoxElement_KeyUp);
            this.textBoxElement.ValueChanged            += new EventHandler(this.maskBox_ValueChanged);
            this.textBoxElement.ValueChanging           += new CancelEventHandler(this.maskBox_ValueChanging);
            this.textBoxElement.TextBoxItem.LostFocus   += new EventHandler(this.maskBox_LostFocus);
            this.textBoxElement.TextBoxItem.TextChanged += new EventHandler(this.maskBox_TextChanged);
            this.textBoxElement.MouseDown               += new MouseEventHandler(this.maskBox_MouseDown);
            this.buttonsLayout = new StackLayoutElement();
            int num13 = (int)this.buttonsLayout.SetDefaultValueOverride(StackLayoutElement.OrientationProperty, (object)Orientation.Vertical);
            int num14 = (int)this.buttonsLayout.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num15 = (int)this.buttonsLayout.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);

            this.buttonsLayout.FitInAvailableSize = true;
            this.buttonsLayout.Class = "DateTimePickerSpinButtonsLayout";
            this.stackLayout.Children.Add((RadElement)this.buttonsLayout);
            this.upButton           = new RadRepeatArrowElement();
            this.upButton.ThemeRole = "UpButton";
            int num16 = (int)this.upButton.SetDefaultValueOverride(RadElement.PaddingProperty, (object)new Padding(3, 1, 3, 1));

            this.upButton.Click         += new EventHandler(this.upButton_Click);
            this.upButton.Direction      = Telerik.WinControls.ArrowDirection.Up;
            this.upButton.Arrow.AutoSize = true;
            this.upButton.CanFocus       = false;
            this.buttonsLayout.Children.Add((RadElement)this.upButton);
            this.downButton           = new RadRepeatArrowElement();
            this.downButton.ThemeRole = "DownButton";
            int num17 = (int)this.downButton.SetDefaultValueOverride(RadElement.PaddingProperty, (object)new Padding(3, 1, 3, 0));
            int num18 = (int)this.downButton.Border.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Visible);

            this.downButton.Click         += new EventHandler(this.downButton_Click);
            this.downButton.Arrow.AutoSize = true;
            this.downButton.Direction      = Telerik.WinControls.ArrowDirection.Down;
            this.downButton.CanFocus       = false;
            this.buttonsLayout.Children.Add((RadElement)this.downButton);
            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);
        }
Exemple #5
0
        /// <summary>
        /// Creates dateTimePicker's children
        /// </summary>
        public override void CreateChildren()
        {
            this.textBoxElement           = new RadMaskedEditBoxElement();
            this.textBoxElement.KeyDown  += new KeyEventHandler(textBoxElement_KeyDown);
            this.textBoxElement.KeyPress += new KeyPressEventHandler(textBoxElement_KeyPress);
            this.textBoxElement.KeyUp    += new KeyEventHandler(textBoxElement_KeyUp);

            this.textBoxElement.Mask                     = "";
            this.textBoxElement.MaskType                 = MaskType.DateTime;
            this.textBoxElement.ValueChanged            += new EventHandler(maskBox_ValueChanged);
            this.textBoxElement.TextBoxItem.LostFocus   += new EventHandler(maskBox_LostFocus);
            this.textBoxElement.TextBoxItem.TextChanged += new EventHandler(maskBox_TextChanged);
            this.textBoxElement.MouseDown               += new MouseEventHandler(maskBox_MouseDown);
            this.textBoxElement.ShowBorder               = false;
            this.textBoxElement.Class                    = "textbox";
            this.textBoxElement.ThemeRole                = "DateTimePickerMaskTextBoxElement";

            this.dockLayout               = new DockLayoutPanel();
            this.border                   = new BorderPrimitive();
            this.backGround               = new FillPrimitive();
            this.checkBox                 = new RadCheckBoxElement();
            this.border.Class             = "DateTimePickerBorder";
            this.backGround.Class         = "DateTimePickerBackGround";
            this.backGround.GradientStyle = GradientStyles.Solid;

            this.checkBox.SetValue(DockLayoutPanel.DockProperty, Dock.Left);
            this.checkBox.Children[1].Alignment = ContentAlignment.MiddleLeft;

            this.checkBox.StretchHorizontally = false;
            this.textBoxElement.Alignment     = ContentAlignment.MiddleLeft;

            this.upButton                   = new RadRepeatArrowElement();
            this.upButton.ThemeRole         = "UpButton";
            this.upButton.Padding           = new Padding(3, 1, 3, 1);
            this.upButton.Border.Visibility = ElementVisibility.Visible;
            this.upButton.Click            += new EventHandler(upButton_Click);
            this.upButton.Direction         = ArrowDirection.Up;
            this.upButton.Arrow.AutoSize    = true;
            this.upButton.CanFocus          = false;

            this.downButton                   = new RadRepeatArrowElement();
            this.downButton.ThemeRole         = "DownButton";
            this.downButton.Padding           = new Padding(3, 1, 3, 0);
            this.downButton.Border.Visibility = ElementVisibility.Visible;
            this.downButton.Click            += new EventHandler(downButton_Click);
            this.downButton.Arrow.AutoSize    = true;
            this.downButton.Direction         = ArrowDirection.Down;
            this.downButton.CanFocus          = false;

            BoxLayout stackLayout = new BoxLayout();

            stackLayout.Orientation = Orientation.Vertical;
            BoxLayout.SetProportion(this.upButton, 1);
            BoxLayout.SetProportion(this.downButton, 1);
            stackLayout.Children.Add(this.upButton);
            stackLayout.Children.Add(this.downButton);

            if (this.dateTimePickerElement.RightToLeft)
            {
                this.checkBox.SetValue(DockLayoutPanel.DockProperty, Dock.Right);
                this.checkBox.Children[1].Alignment = ContentAlignment.MiddleLeft;
                stackLayout.SetValue(DockLayoutPanel.DockProperty, Dock.Left);
                stackLayout.RightToLeft = false;
                this.textBoxElement.TextBoxItem.HostedControl.RightToLeft = RightToLeft.Yes;
            }
            else
            {
                this.checkBox.SetValue(DockLayoutPanel.DockProperty, Dock.Left);
                this.checkBox.Children[1].Alignment = ContentAlignment.MiddleLeft;
                stackLayout.SetValue(DockLayoutPanel.DockProperty, Dock.Right);
                this.textBoxElement.TextBoxItem.HostedControl.RightToLeft = RightToLeft.No;
            }

            this.dockLayout.Children.Add(this.checkBox);
            this.dockLayout.Children.Add(stackLayout);
            this.dockLayout.Children.Add(this.textBoxElement);

            this.dateTimePickerElement.Children.Add(this.backGround);
            this.dateTimePickerElement.Children.Add(this.dockLayout);
            this.dateTimePickerElement.Children.Add(this.border);

            this.dateTimePickerElement.checkBox = this.checkBox;

            if (!this.dateTimePickerElement.ShowCheckBox)
            {
                this.checkBox.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
            }

            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);

            // The BorderPrimitive of the RadTextBoxElement should be collapsed. This makes the size of the editors equal
            this.textBoxElement.Children[this.textBoxElement.Children.Count - 1].Visibility = ElementVisibility.Collapsed;
            this.border.Visibility = ElementVisibility.Visible;

            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);
        }
Exemple #6
0
        /// <summary>
        /// create child elements
        /// </summary>
        protected override void CreateChildElements()
        {
            this.textItem = new RadTextBoxItem();
            this.SetSpinValue(this.value, true);

            this.textItem.TextChanging             += new TextChangingEventHandler(textItem_TextChanging);
            this.textItem.TextChanged              += new EventHandler(textItem_TextChanged);
            this.textItem.LostFocus                += new EventHandler(textItem_LostFocus);
            this.textItem.KeyPress                 += new KeyPressEventHandler(textItem_KeyPress);
            this.textItem.KeyDown                  += new KeyEventHandler(textItem_KeyDown);
            this.textItem.KeyUp                    += new KeyEventHandler(textItem_KeyUp);
            this.textItem.HostedControl.MouseWheel += new MouseEventHandler(textItem_MouseWheel);
            this.textItem.HostedControl.MouseUp    += new MouseEventHandler(HostedControl_MouseUp);
            this.textItem.Alignment                 = ContentAlignment.MiddleLeft;
            this.textItem.StretchHorizontally       = true;
            this.textItem.StretchVertically         = false;

            this.buttonUp           = new RadRepeatArrowElement();
            this.buttonUp.ThemeRole = "UpButton";
            this.buttonUp.Class     = "UpButton";
            //hack!!!!!!!!!!!!
            this.buttonUp.Padding = new Padding(1, 0, 3, 2);
            //this.buttonUp.Margin = new Padding(0, 1, 1, 0);
            //this.buttonUp.Border.Visibility = ElementVisibility.Collapsed;
            this.buttonUp.Click         += new EventHandler(ButtonUp_Click);
            this.buttonUp.DoubleClick   += new EventHandler(ButtonUp_Click);
            this.buttonUp.Direction      = ArrowDirection.Up;
            this.buttonUp.Arrow.AutoSize = true;

            this.buttonDown           = new RadRepeatArrowElement();
            this.buttonDown.ThemeRole = "DownButton";
            this.buttonDown.Class     = "DownButton";
            //hack!!!!!!!!!!!!
            this.buttonDown.Padding = new Padding(1, 1, 3, 1);
            //this.buttonDown.Margin = new Padding(0, 0, 1, 1);
            //this.buttonDown.Border.Visibility = ElementVisibility.Collapsed;
            this.buttonDown.Click         += new EventHandler(ButtonDown_Click);
            this.buttonDown.DoubleClick   += new EventHandler(ButtonDown_Click);
            this.buttonDown.Arrow.AutoSize = true;
            this.buttonDown.Direction      = ArrowDirection.Down;
            this.stackLayout             = new BoxLayout();
            this.stackLayout.Orientation = Orientation.Vertical;
            BoxLayout.SetProportion(this.buttonUp, 1);
            BoxLayout.SetProportion(this.buttonDown, 1);
            this.stackLayout.Children.Add(this.buttonUp);
            this.stackLayout.Children.Add(this.buttonDown);

            this.textBoxFillPrimitive                = new FillPrimitive();
            this.textBoxFillPrimitive.Class          = "SpinElementFill";
            this.textBoxFillPrimitive.NumberOfColors = 1;
            this.textBoxFillPrimitive.MouseDown     += delegate { this.textItem.Focus(); };
            this.Children.Add(this.textBoxFillPrimitive);
            //this.textBoxFillPrimitive.BackColor = this.textItem.BackColor;

            this.dockLayout = new DockLayoutPanel();
            this.dockLayout.LastChildFill = true;

            if (!this.RightToLeft)
            {
                DockLayoutPanel.SetDock(stackLayout, Dock.Right);
            }
            else
            {
                DockLayoutPanel.SetDock(stackLayout, Dock.Left);
            }

            DockLayoutPanel.SetDock(this.textBoxFillPrimitive, Dock.Bottom);
            DockLayoutPanel.SetDock(this.textItem, Dock.Top);

            dockLayout.Children.Add(stackLayout);
            dockLayout.Children.Add(this.textItem);

            this.border       = new BorderPrimitive();
            this.border.Class = "SpinElementBorder";
            this.Children.Add(border);
            this.Children.Add(dockLayout);

            this.textItem.BindProperty(TextPrimitive.TextProperty, this, TextProperty, PropertyBindingOptions.TwoWay);

            this.textItem.Multiline     = false;
            this.textItem.RouteMessages = false;
            this.StretchVertically      = false;
        }