This is a migrated thread and some comments may be shown as answers.

I want to move the controls in the Recurrence Edit Dialog

1 Answer 46 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Linzi
Top achievements
Rank 1
Linzi asked on 22 Dec 2011, 08:34 PM
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

1 Answer, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 27 Dec 2011, 02:32 PM
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.
Tags
Scheduler and Reminder
Asked by
Linzi
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Share this question
or