Unplanned
Last Updated: 14 May 2025 11:56 by Stenly
Stenly
Created on: 14 May 2025 11:56
Category: ScheduleView
Type: Bug Report
0
ScheduleView: Changing the VisibleDays of a view definition causes appointments to not be displayed when IsGroupHeadersVirtualizationEnabled="True"

When the IsGroupHeadersVirtualizationEnabled property is set to True, changing the VisibleDays of the active view definition from a higher value to a smaller one causes appointments to not be displayed.

To work this around, call the Measure method of RadScheduleView when the VisibleDays property changes:

public class RadScheduleViewExtensions
{
    public static int GetVisibleDays(DependencyObject obj)
    {
        return (int)obj.GetValue(VisibleDaysProperty);
    }

    public static void SetVisibleDays(DependencyObject obj, int value)
    {
        obj.SetValue(VisibleDaysProperty, value);
    }

    public static readonly DependencyProperty VisibleDaysProperty =
        DependencyProperty.RegisterAttached("VisibleDays", typeof(int), typeof(RadScheduleViewExtensions), new PropertyMetadata(0, OnVisibleDaysChanged));

    private static void OnVisibleDaysChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        RadScheduleView scheduleView = (RadScheduleView)d;

        if (scheduleView.IsLoaded)
        {
            scheduleView.Measure(Size.Empty);
                
            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                Size renderSize = scheduleView.RenderSize;
                scheduleView.Measure(renderSize);
            }), (DispatcherPriority)3);
        }
    }
}
<telerik:RadScheduleView x:Name="scheduleView"
                         AppointmentsSource="{Binding Appointments}"
                         local:RadScheduleViewExtensions.VisibleDays="{Binding MyPropertyForVisibleDays}"
                         IsGroupHeadersVirtualizationEnabled="True">
    <telerik:RadScheduleView.ViewDefinitions>
        <telerik:DayViewDefinition VisibleDays="{Binding MyPropertyForVisibleDays, Mode=TwoWay}" />
    </telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>
0 comments