Beispiel #1
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.checkBox = new RadCheckBoxElement();
     this.checkBox.ToggleStateChanged += new StateChangedEventHandler(this.checkbox_ToggleStateChanged);
     this.Children.Add((RadElement)this.checkBox);
 }
 public override void ItemStateChanged(
     RadObject senderItem,
     RadPropertyChangedEventArgs changeArgs)
 {
     if (senderItem is RadCheckBoxElement)
     {
         RadCheckBoxElement radCheckBoxElement = senderItem as RadCheckBoxElement;
         if (changeArgs != (RadPropertyChangedEventArgs)null && !radCheckBoxElement.Enabled && radCheckBoxElement.ToggleState != ToggleState.Off)
         {
             string str = "ToggleState=" + (radCheckBoxElement.ToggleState == ToggleState.On ? "On" : "Intermediate");
             this.SetItemState(senderItem, "Disabled" + (object)'.' + str);
         }
         else
         {
             base.ItemStateChanged(senderItem, changeArgs);
         }
     }
     else if (senderItem is RadRadioButtonElement)
     {
         base.ItemStateChanged(senderItem, changeArgs);
     }
     else
     {
         RadToggleButtonElement toggleButtonElement = senderItem as RadToggleButtonElement;
         if (changeArgs != (RadPropertyChangedEventArgs)null && !toggleButtonElement.Enabled && toggleButtonElement.ToggleState == ToggleState.On)
         {
             this.SetItemState(senderItem, "Disabled" + (object)'.' + "ToggleState=On");
         }
         else
         {
             base.ItemStateChanged(senderItem, changeArgs);
         }
     }
 }
Beispiel #3
0
        /// <summary>
        /// Create main button element that is specific for RadCheckBox.
        /// </summary>
        /// <returns>The element that encapsulates the funtionality of RadCheckBox</returns>
        protected override RadButtonElement CreateButtonElement()
        {
            RadCheckBoxElement res = new RadCheckBoxElement();

            res.UseNewLayoutSystem   = true;
            res.ToggleStateChanging += new StateChangingEventHandler(ButtonElement_ToggleStateChanging);
            res.ToggleStateChanged  += new StateChangedEventHandler(ButtonElement_ToggleStateChanged);
            res.PropertyChanged     += new PropertyChangedEventHandler(res_PropertyChanged);
            return(res);
        }
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.checkBoxElement                      = new RadCheckBoxElement();
     this.checkBoxElement.Margin               = new Padding(2, 0, 2, 0);
     this.checkBoxElement.ToggleStateChanged  += new StateChangedEventHandler(this.checkBoxElement_ToggleStateChanged);
     this.checkBoxElement.ToggleStateChanging += new StateChangingEventHandler(this.checkBoxElement_ToggleStateChanging);
     this.checkBoxElement.MouseMove           += new MouseEventHandler(this.checkBoxElement_MouseMove);
     this.ValueElement.Children.Add((RadElement)this.checkBoxElement);
     this.ValueElement.DrawText = false;
 }
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.checkBoxElement           = new RadCheckBoxElement();
            this.checkBoxElement.IsChecked = false;
            this.checkBoxElement.Text      = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("Filter by specific dates:");

            this.checkBoxElement.ToggleStateChanged += new StateChangedEventHandler(this.checkBoxElement_ToggleStateChanged);
            this.checkBoxElement.Margin              = new Padding(0, 10, 0, 5);
            this.Children.Add((RadElement)this.checkBoxElement);
            this.calendarElement         = new FilterMenuCalendarElement();
            this.calendarElement.Enabled = false;
            this.Children.Add((RadElement)this.calendarElement);
        }
Beispiel #6
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);
        }
 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;
        }
Beispiel #9
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);
        }
 public RadCheckBoxElementAccessibleObject(RadCheckBoxElement ownerElement, string name)
     : base(ownerElement.ElementTree.Control, name)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.ToggleStateChanged += new StateChangedEventHandler(this.owner_ToggleStateChanged);
 }
        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;
        }
        /// <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;
        }