Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Scheduler and Reminder > I want to move the controls in the Recurrence Edit Dialog

Not answered I want to move the controls in the Recurrence Edit Dialog

Feed from this thread
  • Linzi avatar

    Posted on Dec 22, 2011 (permalink)

    I want to move the controls in the Recurrence Edit Dialog

    I want to move  the Setting controls in the Recurrence pattern GroupBox
    Example:
    Selected Yearly
    The First  Day of  January 
    Move to 
    of  January  the  First  Day

    sorry for my poor English

    Reply

  • Ivan Todorov Ivan Todorov admin's avatar

    Posted on Dec 27, 2011 (permalink)

    Hello Linzi,

    Thank you for your question.

    It is possible to achieve this by inheriting from a couple of classes. First you need to create a custom YearlyRecurrenceSettings control:
    class CustomYearlyRecurrenceControl : YearlyRecurrenceSettings
    {
        public CustomYearlyRecurrenceControl()
        {
            this.InitializeComponent();
        }
     
        private void InitializeComponent()
        {
            ((System.ComponentModel.ISupportInitialize)(this.radioDayOfMonth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.radioWeekOfMonth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.spinDayNumber)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekNumber)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekdays)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.labelOfMonth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth2)).BeginInit();
            this.SuspendLayout();
            //
            // radioWeekOfMonth
            //
            this.radioWeekOfMonth.Text = "Of";
            //
            // comboBoxMonth1
            //
            //
            //
            //
            this.comboBoxMonth1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
            //
            // spinDayNumber
            //
            //
            //
            //
            this.spinDayNumber.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
            //
            // comboBoxWeekNumber
            //
            this.comboBoxWeekNumber.Location = new System.Drawing.Point(171, 36);
            //
            //
            //
            this.comboBoxWeekNumber.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
            //
            // comboBoxWeekdays
            //
            this.comboBoxWeekdays.Location = new System.Drawing.Point(264, 36);
            //
            //
            //
            this.comboBoxWeekdays.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
            //
            // labelOfMonth
            //
            this.labelOfMonth.Location = new System.Drawing.Point(148, 36);
            this.labelOfMonth.Size = new System.Drawing.Size(22, 16);
            this.labelOfMonth.Text = "the";
            //
            // comboBoxMonth2
            //
            this.comboBoxMonth2.Location = new System.Drawing.Point(55, 36);
            //
            //
            //
            this.comboBoxMonth2.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
            //
            // CustomYearlyRecurrenceControl
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.Location = new System.Drawing.Point(80, 40);
            this.Name = "CustomYearlyRecurrenceControl";
            ((System.ComponentModel.ISupportInitialize)(this.radioDayOfMonth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.radioWeekOfMonth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.spinDayNumber)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekNumber)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxWeekdays)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.labelOfMonth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.comboBoxMonth2)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
     
        }
    }

    As you can see there is some automatically generated code in this class. This is because it is possible to use Visual Studio's designer over the custom control if you define it in a separate file. I used the designer to change the places of the controls.

    Next, you need to create a custom EditRecurrenceDialog which uses the custom control defined above:
    class MyRecurrenceDialog : EditRecurrenceDialog
    {
        public MyRecurrenceDialog(IEvent appointment, ISchedulerData schedulerData)
            : base(appointment, schedulerData)
        { }
     
        protected override void CreateRadioToSettingsDictionary()
        {
            base.CreateRadioToSettingsDictionary();
            this.radioToSettingsDictionary[this.radioYearly] = new CustomYearlyRecurrenceControl();
        }
    }

    Finally, to put this classes in use, we need to handle the RecurrenceEditDialogShowing event of RadScheduler:
    void radScheduler1_RecurrenceEditDialogShowing(object sender, RecurrenceEditDialogShowingEventArgs e)
    {
        e.RecurrenceEditDialog = new MyRecurrenceDialog(e.Appointment, this.radScheduler1);
    }

    I hope you find this useful. Feel free to write back if you have any further questions.

    All the best,
    Ivan Todorov
    the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Scheduler and Reminder > I want to move the controls in the Recurrence Edit Dialog
Related resources for "I want to move the controls in the Recurrence Edit Dialog"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]