Bug in recurrence pattern?

2 posts, 0 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 26 Mar 2015 Link to this post

    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

  2. Nasko
    Admin
    Nasko avatar
    586 posts

    Posted 31 Mar 2015 Link to this post

    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.

     
  3. DevCraft banner
Back to Top