private void CreateElements()
        {
            if (this.timePicker != null)
            {
                this.timePicker.CloseButtonClicked -= new EventHandler(this.timePicker_CloseButtonClicked);
                this.timePicker.ValueChanged       -= new EventHandler(this.timePicker_ValueChanged);
            }
            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);
            }
            if (this.ShowTimePicker)
            {
                this.panel                          = new RadPanel();
                this.calendar.Size                  = new Size(180, 150);
                this.calendar.Dock                  = DockStyle.Left;
                this.timePicker                     = new RadTimePickerContent();
                this.timePicker.ReadOnly            = this.Calendar.ReadOnly;
                this.timePicker.Culture             = this.textBoxElement.Culture;
                this.timePicker.CloseButtonClicked += new EventHandler(this.timePicker_CloseButtonClicked);
                this.timePicker.ValueChanged       += new EventHandler(this.timePicker_ValueChanged);
                this.timePicker.Dock                = DockStyle.Fill;
                if (this.showFooter)
                {
                    this.footerPanel      = new TimePickerDoneButtonContent(this.timePicker.TimePickerElement);
                    this.footerPanel.Dock = DockStyle.Bottom;
                }
                this.panel.Controls.Add((Control)this.timePicker);
                this.panel.Controls.Add((Control)this.calendar);
                if (this.showFooter)
                {
                    this.panel.Controls.Add((Control)this.footerPanel);
                }
            }
            this.popupControl               = new RadDateTimePickerDropDown((RadItem)this.dateTimePickerElement);
            this.popupControl.SizingMode    = SizingMode.UpDownAndRightBottom;
            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.HostedControl = !this.ShowTimePicker ? (RadControl)this.calendar : (RadControl)this.panel;
            string themeName = this.Calendar.ThemeName;

            this.popupControl.ThemeName = themeName;
            if (this.ShowTimePicker && this.TimePicker != null)
            {
                this.panel.ThemeName      = themeName;
                this.TimePicker.ThemeName = themeName;
                if (this.ShowFooter)
                {
                    this.FooterPanel.ThemeName = themeName;
                }
            }
            this.popupControl.LoadElementTree();
        }
Exemple #2
0
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(Control previewSurface)
        {
            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();
            Rectangle editorBounds          = new Rectangle(0, 0, 186, 24);
            Rectangle popupBounds           = new Rectangle(0, 0, 200, 80);

            // DateTimePicker
            RadDateTimePicker radDateTimePickerPreview = new RadDateTimePicker();

            radDateTimePickerPreview.Text   = "RadDropDown";
            radDateTimePickerPreview.Bounds = editorBounds;
            // TODO: remove this PATCH!!!
            radDateTimePickerPreview.LayoutManager.UpdateLayout();

            RadDateTimePicker radDateTimePickerStructure = new RadDateTimePicker();

            radDateTimePickerStructure.Bounds = editorBounds;

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(radDateTimePickerPreview, radDateTimePickerStructure.RootElement);

            designed.Placemenet           = PreviewControlPlacemenet.MiddleCenter;
            designed.MainElementClassName = typeof(RadDateTimePickerElement).FullName;
            res.Add(designed);

            // Popup panel
            //ComboBoxPopupControl popupPanelPreview = new ComboBoxPopupControl();
            RadDateTimePickerDropDown popupPanelPreview = new RadDateTimePickerDropDown(null);

            RadCalendar calendar = new RadCalendar();

            calendar.Bounds = popupBounds;

            popupPanelPreview.HostedControl = calendar;
            popupPanelPreview.Bounds        = popupBounds;
            //popupPanelPreview.PreviewMode = true;

            RadDateTimePickerDropDown popupPanelStructure = new RadDateTimePickerDropDown(null);

            popupPanelStructure.HostedControl = new RadCalendar();
            popupPanelStructure.Bounds        = popupBounds;


            designed            = new ControlStyleBuilderInfo(popupPanelPreview, popupPanelStructure.RootElement);
            designed.Placemenet = PreviewControlPlacemenet.ParentBottomLeft;
            res.Add(designed);

            return(res);
        }
 private void DisposeNavigationElements()
 {
     if (this.scrollingTimer != null)
     {
         this.scrollingTimer.Stop();
         this.scrollingTimer.Dispose();
     }
     if (this.dropDown != null)
     {
         this.dropDown.Dispose();
         this.dropDown = null;
     }
     if (this.hostedControl != null)
     {
         this.hostedControl.Dispose();
         this.hostedControl = null;
     }
 }
        /// <summary>
        /// Represents the RadDateTimePickerCalendar constructor
        /// </summary>
        /// <param name="dateTimePicker"></param>
        public RadDateTimePickerCalendar(RadDateTimePickerElement dateTimePicker)
        {
            this.dateTimePickerElement = dateTimePicker;

            this.calendar           = new RadCalendar();
            this.calendar.Focusable = false;

            this.popupControl            = new RadDateTimePickerDropDown(this.dateTimePickerElement);
            this.popupControl.SizingMode = SizingMode.UpDownAndRightBottom;
            this.popupControl.Opened    += new EventHandler(controlPanel_Opened);
            this.popupControl.Closing   += new RadPopupClosingEventHandler(controlPanel_Closing);
            this.popupControl.Closed    += new RadPopupClosedEventHandler(controlPanel_Closed);

            this.popupControl.HostedControl = this.calendar;
            this.popupControl.LoadElementTree();
            this.calendar.AllowMultipleSelect = false;
            this.calendar.SelectionChanged   += new EventHandler(calendar_SelectionChanged);
        }
        protected override void InitializeFields()
        {
            base.InitializeFields();

            this.UseNewLayoutSystem = true;
            this.StretchVertically  = false;
            this.DrawFill           = true;
            this.Class         = "CalendarNavigationElement";
            this.TextAlignment = ContentAlignment.MiddleCenter;

            this.scrollingTimer          = new Timer();
            this.scrollingTimer.Tick    += new EventHandler(scrollingTimer_Tick);
            this.scrollingTimer.Interval = 1000;

            this.dropDown                       = new RadDateTimePickerDropDown(this);
            this.hostedControl                  = new RadCalendarFastNavigationControl();
            this.dropDown.HostedControl         = this.hostedControl;
            this.dropDown.SizingGrip.Visibility = ElementVisibility.Collapsed;
            this.hostedControl.ThemeName        = "ControlDefault";
            this.dropDown.BackColor             = Color.White;
            this.dropDown.AnimationEnabled      = false;
        }
 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 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;
        }