Completed
Last Updated: 06 Jun 2019 13:27 by ADMIN
Release R2 2019 SP1 (LIB 2019.2.610)
Jacint
Created on: 03 Jun 2019 06:30
Category: Scheduler/Reminder
Type: Bug Report
1
RadScheduler: Setting the ShowFullMonth property to true in the month view and calling the OffsetView method with a 0 step unexpectedly changes the currently visible view.
Calling the method with 0 step should not change the view.
1 comment
ADMIN
Hristo
Posted on: 03 Jun 2019 07:12
Hi,

Workaround: Create a custom control and override the OffsetView method: 
public class CustomRadScheduler : RadScheduler
{
    private FieldInfo schedulerFi;
    private FieldInfo activeViewsFi;
    private MethodInfo onPropertyChangedMi;
    private MethodInfo setActiveViewMi;
  
    protected override void CreateChildItems(RadElement parent)
    {
        base.CreateChildItems(parent);
  
        this.activeViewsFi = typeof(RadScheduler).GetField("activeViews", BindingFlags.Instance | BindingFlags.NonPublic);
        this.schedulerFi = typeof(SchedulerView).GetField("scheduler", BindingFlags.Instance | BindingFlags.NonPublic);
        this.onPropertyChangedMi = typeof(SchedulerView).GetMethod("OnPropertyChanged", BindingFlags.Instance | BindingFlags.NonPublic);
        this.setActiveViewMi = typeof(RadScheduler).GetMethod("SetActiveView", BindingFlags.Instance | BindingFlags.NonPublic);
    }
  
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadScheduler).FullName;
        }
    }
  
    /// <summary>
    /// Gets or sets the type of the active view.
    /// </summary>
    /// <value>The type of the active view.</value>
    [DefaultValue(SchedulerViewType.Day)]
    [NotifyParentProperty(true)]
    public override SchedulerViewType ActiveViewType
    {
        get
        {
            return base.ActiveViewType;
        }
        set
        {
            if (this.ActiveViewType != value && value == SchedulerViewType.Month)
            {
                SchedulerView newView;
                Dictionary<SchedulerViewType, SchedulerView> activeViews = this.activeViewsFi.GetValue(this) as Dictionary<SchedulerViewType, SchedulerView>;
                if (activeViews.ContainsKey(value))
                {
                    newView = activeViews[value];
                }
                else
                {
                    SchedulerView view = new CustomSchedulerMonthView();
                    this.schedulerFi.SetValue(view, this);
                    this.onPropertyChangedMi.Invoke(view, new object[] { new string[] { "Scheduler" } });
                    newView = view;
                }
  
                if (this.ActiveView != newView && newView != null)
                {
                    this.setActiveViewMi.Invoke(this, new object[] { newView, true });
                }
            }
            else
            {
                base.ActiveViewType = value;
            }
        }
    }
}
  
public class CustomSchedulerMonthView : SchedulerMonthView
{
    public override SchedulerView OffsetView(int offset)
    {
        if (offset == 0)
        {
            return this;
        }
  
        return base.OffsetView(offset);
    }
}


Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.