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>