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

Bug in recurrence pattern?

1 Answer 49 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Håkan
Top achievements
Rank 1
Håkan asked on 26 Mar 2015, 09:14 AM
Hi!

I have styled some special slots to display saturdays and sundays with a different background color in the month view.
But in the last week of the year, the special slots are not drawn, see attaced image.
It does not matter if the year ends on a sunday or not, its always the last week that is missing.

I have tried with and without the RecursUntil property with no result.

This is my code:
public static ObservableCollection<Slot> SetupSpecialSlots(bool readOnly, DateTime? start = null, DateTime? end = null)
        {
            ObservableCollection<Slot> specialSlots = new ObservableCollection<Slot>();
 
            if (!start.HasValue)
                start = CalendarUtility.GetFirstDateOfYear();
            if (!end.HasValue)
                end = CalendarUtility.MergeDateAndTime(CalendarUtility.GetFirstDateOfYear(), new TimeSpan(23, 59, 59));
 
            Slot slot = null;          
 
            slot = CreateSpecialSlot(new SaturdayOccurence(), start.Value, end.Value, readOnly);
            slot.RecurrencePattern = new RecurrencePattern(null, RecurrenceDays.Saturday, RecurrenceFrequency.Weekly, 1, null, null);
            specialSlots.Add(slot);
 
            slot = CreateSpecialSlot(new SundayOccurence(), start.Value, end.Value, readOnly);
            slot.RecurrencePattern = new RecurrencePattern(null, RecurrenceDays.Sunday, RecurrenceFrequency.Weekly, 1, null, null);
            specialSlots.Add(slot);
 
            return specialSlots;
        }

<util:CustomSpecialSlotStyleSelector x:Key="TimeCalendarSpecialSlotStyleSelectorMonthView">
            <util:CustomSpecialSlotStyleSelector.DefaultStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Margin" Value="0,-47,0,0" />
                    <Setter Property="Background" Value="{x:Null}" />
                </Style>
            </util:CustomSpecialSlotStyleSelector.DefaultStyle>
            <util:CustomSpecialSlotStyleSelector.ReadOnlyStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Margin" Value="0,-47,0,0" />
                    <Setter Property="Background" Value="{x:Null}" />
                </Style>
            </util:CustomSpecialSlotStyleSelector.ReadOnlyStyle>
            <util:CustomSpecialSlotStyleSelector.SaturdayStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Margin" Value="0,-47,0,0" />
                    <Setter Property="Background" Value="{StaticResource PaleBlueBrush}" />
                </Style>
            </util:CustomSpecialSlotStyleSelector.SaturdayStyle>
            <util:CustomSpecialSlotStyleSelector.SundayStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Margin" Value="0,-47,0,0" />
                    <Setter Property="Background" Value="{StaticResource PaleRedBrush}" />
                </Style>
            </util:CustomSpecialSlotStyleSelector.SundayStyle>
        </util:CustomSpecialSlotStyleSelector>
public class CustomSpecialSlotStyleSelector : ScheduleViewStyleSelector
    {
        public Style DefaultStyle { get; set; }
        public Style ReadOnlyStyle { get; set; }
        public Style SaturdayStyle { get; set; }
        public Style SundayStyle { get; set; }
 
        public override Style SelectStyle(object item, DependencyObject container, ViewDefinitionBase activeViewDefinition)
        {
            if (item is DefaultOccurence)
                return this.DefaultStyle;
            else if (item is ReadOnlyOccurence)
                return this.ReadOnlyStyle;
            else if (item is SundayOccurence)
                return this.SundayStyle;
            else if (item is SaturdayOccurence)
                return this.SaturdayStyle;
            return base.SelectStyle(item, container, activeViewDefinition);
        }
    }



Regards,
HÃ¥kan

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 31 Mar 2015, 07:53 AM
Hello Hakan,

We tried to reproduce the observed by you appearance of the SpecialSlots using the provided code snippet but it seems everything works as expected on our side - please, check the attached sample project. So, could you please provide us some more detailed information about your scenario or modify the sample project in order to reproduce the observed appearance? Thus we could be able to continue our investigation and provide you with a prompt solution if possible.

We're looking forward to hearing from you.

Regards,
Nasko
Telerik
 

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

 
Tags
ScheduleView
Asked by
Håkan
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or