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

Multi RadScheduler associated to one SchedulerNavigator

3 Answers 94 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Luigi
Top achievements
Rank 1
Luigi asked on 15 Jul 2014, 03:17 PM
HI,

How i can associate two or many radscheduler at the same radschedulernavigator?

I must to create a form that have 1 radschedulernavigator and 2 radscheduler where i must to show different information.

Thanks

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 16 Jul 2014, 12:54 PM
Hello Luigi,

Thank you for writing.

You cannot associate more than one RadScheduler with a RadBindingNavigator at a time. You can, however put a RadDropDownList with the available schedulers. So that when a value is selected the AssociatedScheduler property of the navigator will be changed. For example here is a sample code:
this.DropDownList = new RadDropDownList();
this.DropDownList.Parent = this;
this.DropDownList.Dock = DockStyle.Top;
 
List<SchedulerWrapper> schedulers = new List<SchedulerWrapper>();
RadScheduler scheduler1 = new RadScheduler()
{
    Parent = this,
    Dock = DockStyle.Right
};
 
RadScheduler scheduler2 = new RadScheduler()
{
    Parent = this,
    Dock = DockStyle.Left
};
 
schedulers.Add(new SchedulerWrapper(scheduler1));
schedulers.Add(new SchedulerWrapper(scheduler2));
 
this.DropDownList.DataSource = schedulers;
this.DropDownList.DisplayMember = "Name";
this.DropDownList.DataMember = "Scheduler";
this.DropDownList.SelectedValueChanged += dropDownList_SelectedValueChanged;
 
private RadSchedulerNavigator navigaror;
void dropDownList_SelectedValueChanged(object sender, EventArgs e)
{
    this.navigaror.AssociatedScheduler = (this.DropDownList.SelectedItem.DataBoundItem as SchedulerWrapper).Scheduler;
}
 
class SchedulerWrapper
{
    public string Name
    {
        get { return this.Scheduler.Name; }
    }
 
    public RadScheduler Scheduler { get; private set; }
 
    public SchedulerWrapper(RadScheduler scheduler)
    {
        this.Scheduler = scheduler;
    }
}

The SchedulerWrapper class is needed since you can bind only to properties which are declared in the bound type.

I hope this helps.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Luigi
Top achievements
Rank 1
answered on 23 Apr 2015, 10:17 AM

Hello George

Now I have the same necessity, but i must not insert a dropdownlist
How I can do?
With one Navigator i must do automatic change 2 schedulers
In attach find a screenshot of my form.
Thanks

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Apr 2015, 06:42 AM
Hello Luigi,

Thank you for writing.

RadSchedulerNavigator can be associated to only one RadScheduler at a time. However, you can subscribe to all events introduced by the navigator and affect the second scheduler as well. Here is a sample code snippet demonstrating how to handle most of the events and affect the second scheduler:
public Form1()
{
    InitializeComponent();
 
    this.radSchedulerNavigator1.AssociatedScheduler = this.radScheduler1;
    this.radSchedulerNavigator1.DayViewClick += radSchedulerNavigator1_DayViewClick;
    this.radSchedulerNavigator1.WeekViewClick += radSchedulerNavigator1_WeekViewClick;
    this.radSchedulerNavigator1.MonthViewClick += radSchedulerNavigator1_MonthViewClick;
    this.radSchedulerNavigator1.TimelineViewClick += radSchedulerNavigator1_TimelineViewClick;
    this.radSchedulerNavigator1.ShowWeekendStateChanged += radSchedulerNavigator1_ShowWeekendStateChanged;
    this.radSchedulerNavigator1.NavigateBackwardsClick += radSchedulerNavigator1_NavigateBackwardsClick;
    this.radSchedulerNavigator1.NavigateForwardsClick += radSchedulerNavigator1_NavigateForwardsClick;
}
 
private void radSchedulerNavigator1_NavigateForwardsClick(object sender, EventArgs e)
{
    int navigationStep = this.radSchedulerNavigator1.SchedulerNavigatorElement.NavigationStep;
    NavigationStepTypes navigationStepType = this.radSchedulerNavigator1.SchedulerNavigatorElement.NavigationStepType;
     
    switch (this.radScheduler2.ActiveViewType)
    {
        case SchedulerViewType.Day:
        case SchedulerViewType.MultiDay:
            navigationStep = 1;
            navigationStepType = NavigationStepTypes.Day;
            break;
        case SchedulerViewType.Timeline:
            navigationStep = 1;
            navigationStepType = StepsByScalling(this.radScheduler2.GetTimelineView().GetScaling().Timescale, ref navigationStep);
            break;
        case SchedulerViewType.Week:
        case SchedulerViewType.WorkWeek:
            navigationStep = 1;
            navigationStepType = NavigationStepTypes.Week;
            break;
        case SchedulerViewType.Month:
            navigationStep = 1;
            if (!this.radScheduler2.GetMonthView().ShowWeekend)
            {
                navigationStep += 2;
            }
            DateTime endDate = this.radScheduler2.ActiveView.EndDate.AddDays(navigationStep);
            DateTime dtStart = this.radScheduler2.ActiveView.StartDate;
            DateTime dtStartMonth = new DateTime(endDate.Year, endDate.Month, 1);
            navigationStep = dtStartMonth.Subtract(dtStart).Days;
            navigationStepType = NavigationStepTypes.Day;
            this.radScheduler2.GetMonthView().WeekCount = DateHelper.GetMonthDisplayWeeks(dtStartMonth, this.radScheduler2.Culture.DateTimeFormat);
            break;
    }
 
    RadScheduler.NavigateToNextViewCommand.ExecuteCommand(this.radScheduler2, navigationStepType, navigationStep);
}
 
private void radSchedulerNavigator1_NavigateBackwardsClick(object sender, EventArgs e)
{
    int navigationStep = this.radSchedulerNavigator1.SchedulerNavigatorElement.NavigationStep;
    NavigationStepTypes navigationStepType = this.radSchedulerNavigator1.SchedulerNavigatorElement.NavigationStepType;
 
    switch (this.radScheduler2.ActiveViewType)
    {
        case SchedulerViewType.Day:
            navigationStep = 1;
            navigationStepType = NavigationStepTypes.Day;
            break;
        case SchedulerViewType.Timeline:
            navigationStep = 1;
            navigationStepType = StepsByScalling(this.radScheduler2.GetTimelineView().GetScaling().Timescale, ref navigationStep);
            break;
        case SchedulerViewType.Week:
        case SchedulerViewType.WorkWeek:
            navigationStep = 1;
            navigationStepType = NavigationStepTypes.Week;
            break;
        case SchedulerViewType.Month:
            navigationStep = 1;
            if (!this.radScheduler2.GetMonthView().ShowWeekend)
            {
                navigationStep += 2;
            }
            DateTime dtStart = this.radScheduler2.ActiveView.StartDate.AddDays(-navigationStep);
            DateTime dtStartMonth = new DateTime(dtStart.Year, dtStart.Month, 1);
            navigationStep = this.radScheduler2.ActiveView.StartDate.Subtract(dtStartMonth).Days;
            navigationStepType = NavigationStepTypes.Day;
            this.radScheduler2.GetMonthView().WeekCount = DateHelper.GetMonthDisplayWeeks(dtStartMonth, CultureInfo.CurrentCulture.DateTimeFormat);
            break;
    }
 
    RadScheduler.NavigateToPreviousViewCommand.ExecuteCommand(this.radScheduler2, navigationStepType, navigationStep);
}
 
private NavigationStepTypes StepsByScalling(Timescales timescale, ref int navigationStep)
{
    NavigationStepTypes navigationStepType = NavigationStepTypes.Day;
    switch (timescale)
    {
        case Timescales.Minutes:
            navigationStepType = NavigationStepTypes.Minute;
            navigationStep = 15;
            break;
        case Timescales.HalfHour:
            navigationStepType = NavigationStepTypes.Minute;
            navigationStep = 30;
            break;
        case Timescales.Hours:
            navigationStepType = NavigationStepTypes.Hour;
            break;
        case Timescales.Days:
            navigationStepType = NavigationStepTypes.Day;
            break;
        case Timescales.Weeks:
            navigationStepType = NavigationStepTypes.Week;
            break;
        case Timescales.Months:
            navigationStepType = NavigationStepTypes.Month;
            break;
        case Timescales.Years:
            navigationStepType = NavigationStepTypes.Year;
            break;
    }
 
    return navigationStepType;
}
 
private void radSchedulerNavigator1_ShowWeekendStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args)
{
    if (this.radScheduler2.ActiveView is SchedulerWeekView)
    {
        (this.radScheduler2.ActiveView as SchedulerWeekView).ShowWeekend =
                                                                          this.radSchedulerNavigator1.ShowWeekendCheckBox.ToggleState == ToggleState.On;
    }
    else if (this.radScheduler2.ActiveView is SchedulerMonthView)
    {
        (this.radScheduler2.ActiveView as SchedulerMonthView).ShowWeekend =
                                                                           this.radSchedulerNavigator1.ShowWeekendCheckBox.ToggleState == ToggleState.On;
    }
}
 
private void radSchedulerNavigator1_TimelineViewClick(object sender, EventArgs e)
{
    this.radScheduler2.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Timeline;
}
 
private void radSchedulerNavigator1_MonthViewClick(object sender, EventArgs e)
{
    this.radScheduler2.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Month;
}
 
private void radSchedulerNavigator1_WeekViewClick(object sender, EventArgs e)
{
    this.radScheduler2.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Week;
}
 
private void radSchedulerNavigator1_DayViewClick(object sender, EventArgs e)
{
    this.radScheduler2.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Day;
}

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Scheduler and Reminder
Asked by
Luigi
Top achievements
Rank 1
Answers by
George
Telerik team
Luigi
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or