Ejemplo n.º 1
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.arrowButton = this.CreateArrowButtonElement();
            int num1 = (int)this.arrowButton.Border.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Collapsed);

            this.arrowButton.ClickMode           = ClickMode.Press;
            this.arrowButton.Click              += new EventHandler(this.arrow_Click);
            this.arrowButton.ZIndex              = 1;
            this.arrowButton.StretchHorizontally = false;
            this.arrowButton.StretchVertically   = true;
            this.borderPrimitive       = new BorderPrimitive();
            this.borderPrimitive.Class = "DropDownListBorder";
            this.Children.Add((RadElement)this.borderPrimitive);
            this.fillPrimitive                     = new FillPrimitive();
            this.fillPrimitive.Class               = "DropDownFill";
            this.fillPrimitive.ZIndex              = -1;
            this.fillPrimitive.RadPropertyChanged += new RadPropertyChangedEventHandler(this.fillPrimitive_RadPropertyChanged);
            this.Children.Add((RadElement)this.fillPrimitive);
            StackLayoutElement stackLayoutElement = new StackLayoutElement();

            stackLayoutElement.CanFocus            = false;
            stackLayoutElement.StretchVertically   = true;
            stackLayoutElement.StretchHorizontally = true;
            stackLayoutElement.Class = "DropDownListStack";
            stackLayoutElement.FitInAvailableSize = true;
            this.Children.Add((RadElement)stackLayoutElement);
            this.containerElement           = new RadDropDownListEditableAreaElement((RadDropDownListElement)null);
            this.editableElement            = (RadTextBoxElement)this.containerElement.TextBox;
            this.editableElement.Visibility = ElementVisibility.Hidden;
            this.containerElement.DrawText  = true;
            stackLayoutElement.Children.Add((RadElement)this.containerElement);
            stackLayoutElement.Children.Add((RadElement)this.arrowButton);
            int num2 = (int)this.BindProperty(RadItem.TextProperty, (RadObject)this.editableElement, RadItem.TextProperty, PropertyBindingOptions.TwoWay);
        }
Ejemplo n.º 2
0
        protected override void CreateChildItems(RadElement parent)
        {
            if (this.dropDownButtonElement == null)
            {
                this.dropDownButtonElement = this.CreateButtonElement();
            }
            this.dropDownButtonElement.Owner            = this;
            this.dropDownButtonElement.DropDownOpening += new CancelEventHandler(this.dropDownButtonElement_DropDownOpening);
            this.dropDownButtonElement.DropDownOpened  += new EventHandler(this.dropDownButtonElement_DropDownOpened);
            this.dropDownButtonElement.DropDownClosed  += new EventHandler(this.dropDownButtonElement_DropDownClosed);

            this.RootElement.Children.Add(this.dropDownButtonElement);
            this.dropDownButtonElement.BindProperty(RadDropDownButtonElement.AutoSizeModeProperty,
                                                    this.RootElement, RootRadElement.AutoSizeModeProperty, PropertyBindingOptions.OneWay);

            RadArrowButtonElement arrowButton = this.dropDownButtonElement.ArrowButton;

            arrowButton.Arrow.AutoSize = true;

            base.CreateChildItems(parent);
        }
Ejemplo n.º 3
0
        protected override void CreateChildElements()
        {
            this.arrowButton         = new RadArrowButtonElement();
            this.arrowButton.MinSize = RadDropDownButtonElement.ArrowButtonDefaultSize;
            this.arrowButton.SetValue(DropDownEditorLayoutPanel.IsArrowButtonProperty, true);
            this.arrowButton.Class       = "DropDownButtonArrowButton";
            this.arrowButton.MouseEnter += new EventHandler(arrowButton_MouseEnter);
            this.arrowButton.MouseLeave += new EventHandler(arrowButton_MouseLeave);
            this.arrowButton.Click      += new EventHandler(arrowButton_Click);

            this.actionButton = new ActionButtonElement();
            this.actionButton.BindProperty(RadButtonElement.DisplayStyleProperty, this, RadButtonItem.DisplayStyleProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.ImageAlignmentProperty, this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.TextAlignmentProperty, this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.TextImageRelationProperty, this, RadButtonItem.TextImageRelationProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.TextProperty, this, RadButtonItem.TextProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.BindProperty(RadButtonElement.ImageIndexProperty, this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.BindProperty(RadButtonElement.ImageProperty, this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.BindProperty(RadButtonElement.ImageKeyProperty, this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.SetValue(DropDownEditorLayoutPanel.IsContentProperty, true);
            this.actionButton.MouseLeave += new EventHandler(actionButton_MouseLeave);
            this.actionButton.MouseEnter += new EventHandler(actionButton_MouseEnter);
            this.actionButton.Click      += new EventHandler(actionButton_Click);
            this.actionButton.NotifyParentOnMouseInput = true;

            this.layoutPanel = new DropDownEditorLayoutPanel();
            this.layoutPanel.BindProperty(DropDownEditorLayoutPanel.AutoSizeModeProperty, this, RadDropDownButtonElement.AutoSizeModeProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.Children.Add(this.arrowButton);
            this.layoutPanel.Children.Add(this.actionButton);
            DockLayoutPanel.SetDock(arrowButton, Dock.Right);
            DockLayoutPanel.SetDock(actionButton, Dock.Left);
            layoutPanel.LastChildFill = true;

            this.borderPrimitive = new BorderPrimitive();
            this.borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
            this.borderPrimitive.Class        = "DropDownButtonBorder";
            this.Children.Add(this.borderPrimitive);
            this.Children.Add(this.layoutPanel);
        }
 public void Dispose()
 {
     if (this.textBoxElement != null)
     {
         this.textBoxElement.ValueChanged          -= new EventHandler(this.maskBox_ValueChanged);
         this.textBoxElement.ValueChanging         -= new CancelEventHandler(this.maskBox_ValueChanging);
         this.textBoxElement.MaskProviderCreated   -= new EventHandler(this.textBoxElement_MaskProviderCreated);
         this.textBoxElement.TextBoxItem.LostFocus -= new EventHandler(this.MaskBox_LostFocus);
         this.textBoxElement.TextBoxItem.MouseDown -= new MouseEventHandler(this.maskBox_MouseDown);
         this.textBoxElement.KeyDown  -= new KeyEventHandler(this.textBoxElement_KeyDown);
         this.textBoxElement.KeyPress -= new KeyPressEventHandler(this.textBoxElement_KeyPress);
         this.textBoxElement.KeyUp    -= new KeyEventHandler(this.textBoxElement_KeyUp);
     }
     if (this.calendar != null)
     {
         this.calendar.SelectionChanged -= new EventHandler(this.calendar_SelectionChanged);
         this.calendar.Dispose();
         this.calendar = (RadCalendar)null;
     }
     if (this.timePicker != null)
     {
         this.timePicker.ValueChanged       -= new EventHandler(this.timePicker_ValueChanged);
         this.timePicker.CloseButtonClicked -= new EventHandler(this.timePicker_CloseButtonClicked);
     }
     if (this.popupControl != null)
     {
         this.popupControl.Opened  -= new EventHandler(this.popupControl_Opened);
         this.popupControl.Closing -= new RadPopupClosingEventHandler(this.popupControl_Closing);
         this.popupControl.Closed  -= new RadPopupClosedEventHandler(this.popupControl_Closed);
         this.popupControl.Dispose();
         this.popupControl = (RadDateTimePickerDropDown)null;
     }
     if (this.textBoxElement != null)
     {
         this.textBoxElement.Dispose();
         this.textBoxElement.DisposeChildren();
         this.textBoxElement = (RadMaskedEditBoxElement)null;
     }
     if (this.checkBox != null)
     {
         this.checkBox.Dispose();
         this.checkBox = (RadCheckBoxElement)null;
     }
     if (this.stackLayout != null)
     {
         this.stackLayout.Dispose();
         this.stackLayout = (StackLayoutElement)null;
     }
     if (this.border != null)
     {
         this.border.Dispose();
         this.border = (BorderPrimitive)null;
     }
     if (this.backGround != null)
     {
         this.backGround.Dispose();
         this.backGround = (FillPrimitive)null;
     }
     if (this.arrowButton == null)
     {
         return;
     }
     this.arrowButton.Dispose();
     this.arrowButton = (RadArrowButtonElement)null;
 }
        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.border.Visibility = ElementVisibility.Visible;
            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.Class = "DateTimePickerCalendarLayout";
            this.stackLayout.FitInAvailableSize = true;
            this.stackLayout.CanFocus           = false;
            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);

            this.stackLayout.Children.Add((RadElement)this.checkBox);
            this.dateTimePickerElement.CheckBox = this.checkBox;
            if (!this.dateTimePickerElement.ShowCheckBox)
            {
                this.checkBox.Visibility = ElementVisibility.Collapsed;
            }
            this.textBoxElement = new RadMaskedEditBoxElement();
            this.textBoxElement.MaskProviderCreated += new EventHandler(this.textBoxElement_MaskProviderCreated);
            this.textBoxElement.Mask       = "";
            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.Border.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Hidden);
            int num11 = (int)this.textBoxElement.Border.SetDefaultValueOverride(VisualElement.ForeColorProperty, (object)Color.Transparent);
            int num12 = (int)this.textBoxElement.Fill.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);
            int num13 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)false);
            int num14 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);

            this.stackLayout.Children.Add((RadElement)this.textBoxElement);
            int num15 = (int)this.textBoxElement.Children[this.TextBoxElement.Children.Count - 1].SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Collapsed);

            this.textBoxElement.MaskType               = MaskType.DateTime;
            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.MouseDown += new MouseEventHandler(this.maskBox_MouseDown);
            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.arrowButton              = (RadArrowButtonElement) new RadDateTimePickerArrowButtonElement();
            this.arrowButton.Class        = "ArrowButton";
            int num16 = (int)this.arrowButton.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num17 = (int)this.arrowButton.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num18 = (int)this.arrowButton.Arrow.SetDefaultValueOverride(RadElement.AutoSizeProperty, (object)true);
            int num19 = (int)this.arrowButton.Arrow.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleCenter);
            int num20 = (int)this.arrowButton.SetDefaultValueOverride(RadElement.MinSizeProperty, (object)new Size(17, 6));

            this.stackLayout.Children.Add((RadElement)this.arrowButton);
            this.arrowButton.MouseDown -= new MouseEventHandler(this.arrowButton_MouseDown);
            this.arrowButton.MouseDown += new MouseEventHandler(this.arrowButton_MouseDown);
            if (this.dateTimePickerElement.RightToLeft)
            {
                this.calendar.RightToLeft = RightToLeft.Yes;
            }
            else
            {
                this.calendar.RightToLeft = RightToLeft.No;
            }
            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);
            this.calendar.RangeMinDate = this.DateTimePickerElement.MinDate;
            this.calendar.RangeMaxDate = this.DateTimePickerElement.MaxDate;
        }
Ejemplo n.º 6
0
        public void Dispose()
        {
            if (this.textBoxElement.Value != null)
            {
                textBoxElement.ValueChanged            -= new EventHandler(maskBox_ValueChanged);
                textBoxElement.TextBoxItem.LostFocus   -= new EventHandler(MaskBox_LostFocus);
                textBoxElement.TextBoxItem.GotFocus    -= new EventHandler(maskBox_GotFocus);
                textBoxElement.TextBoxItem.MouseDown   -= new MouseEventHandler(maskBox_MouseDown);
                textBoxElement.TextBoxItem.TextChanged -= new EventHandler(maskBox_TextChanged);
            }

            if (this.textBoxElement != null)
            {
                this.textBoxElement.KeyDown  -= new KeyEventHandler(textBoxElement_KeyDown);
                this.textBoxElement.KeyPress -= new KeyPressEventHandler(textBoxElement_KeyPress);
                this.textBoxElement.KeyUp    -= new KeyEventHandler(textBoxElement_KeyUp);
            }

            if (this.popupControl != null)
            {
                this.popupControl.Opened  -= new EventHandler(controlPanel_Opened);
                this.popupControl.Closing -= new RadPopupClosingEventHandler(controlPanel_Closing);
                this.popupControl.Closed  -= new RadPopupClosedEventHandler(controlPanel_Closed);
                this.popupControl.Dispose();
                this.popupControl = null;
            }

            if (this.calendar != null)
            {
                this.calendar.SelectionChanged -= new EventHandler(calendar_SelectionChanged);
                this.calendar.Dispose();
                this.calendar = null;
            }

            if (this.textBoxElement != null)
            {
                this.textBoxElement.Dispose();
                this.textBoxElement.DisposeChildren();
                this.textBoxElement = null;
            }

            if (this.checkBox != null)
            {
                this.checkBox.Dispose();
                this.checkBox = null;
            }

            if (this.dockLayout != null)
            {
                this.dockLayout.Dispose();
                this.dockLayout = null;
            }

            if (this.border != null)
            {
                this.border.Dispose();
                this.border = null;
            }

            if (this.backGround != null)
            {
                this.backGround.Dispose();
                this.backGround = null;
            }

            if (this.arrowButton != null)
            {
                this.arrowButton.Dispose();
                this.arrowButton = null;
            }
            //private RadArrowButtonElement arrowButton;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates dateTimePicker's children
        /// </summary>
        public override void CreateChildren()
        {
            this.textBoxElement = new RadMaskedEditBoxElement();
            // textBoxElement = this.textBoxElement.TextBoxItem.HostedControl as RadMaskTextBox;
            this.textBoxElement.Mask                = "";
            textBoxElement.MaskType                 = MaskType.DateTime;
            textBoxElement.ValueChanged            += new EventHandler(maskBox_ValueChanged);
            textBoxElement.TextBoxItem.LostFocus   += new EventHandler(MaskBox_LostFocus);
            textBoxElement.TextBoxItem.GotFocus    += new EventHandler(maskBox_GotFocus);
            textBoxElement.TextBoxItem.MouseDown   += new MouseEventHandler(maskBox_MouseDown);
            textBoxElement.TextBoxItem.TextChanged += new EventHandler(maskBox_TextChanged);
            this.textBoxElement.KeyDown            += new KeyEventHandler(textBoxElement_KeyDown);
            this.textBoxElement.KeyPress           += new KeyPressEventHandler(textBoxElement_KeyPress);
            this.textBoxElement.KeyUp              += new KeyEventHandler(textBoxElement_KeyUp);

            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.arrowButton              = new RadDateTimePickerArrowButtonElement();
            this.arrowButton.Class        = "ArrowButton";
            this.border.Class             = "DateTimePickerBorder";
            this.backGround.Class         = "DateTimePickerBackGround";
            this.backGround.GradientStyle = GradientStyles.Solid;

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

            this.arrowButton.StretchHorizontally = false;
            this.checkBox.StretchHorizontally    = false;
            this.textBoxElement.Alignment        = ContentAlignment.MiddleLeft;
            this.arrowButton.Arrow.AutoSize      = true;
            this.arrowButton.Arrow.Alignment     = ContentAlignment.MiddleCenter;
            this.arrowButton.MinSize             = new Size(17, 6);

            this.dockLayout.Children.Add(this.checkBox);
            this.dockLayout.Children.Add(this.arrowButton);
            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);
            this.arrowButton.MouseDown += new MouseEventHandler(arrowButton_MouseDown);

            // 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.calendar.RangeMinDate = this.DateTimePickerElement.MinDate;
            this.calendar.RangeMaxDate = this.DateTimePickerElement.MaxDate;
        }