Not showing slots with grouping

10 posts, 0 answers
  1. Freeport LNG Development
    Freeport LNG Development avatar
    8 posts
    Member since:
    Apr 2010

    Posted 16 Dec 2011 Link to this post

    Hello all

    I am having trouble getting the Special Slots to visualize when i am grouping. WIthout the grouping they show as expected, but when the reousece grouping is defined it does not show. I even try to add all the resources used for the grouping on all Slots but they still do not show. Any quick pointers?

    I am using this to initialize my slot collection:

                ObservableCollection<Slot> specialSlots = new ObservableCollection<Slot>();
                Providers.SundayOccurence sunday = new Providers.SundayOccurence()
                {
                    Start = StartTime,
                    End = StartTime.AddDays(1).AddSeconds(-1),
                    RecurrencePattern = new RecurrencePattern(null, RecurrenceDays.Sunday, RecurrenceFrequency.Weekly, 1, null, null),
                };
                sunday.Resources.Add(this.ResourceTypes[0]);
                foreach (Resource r in this.ResourceTypes[0].Resources)
                {
                    sunday.Resources.Add(new Resource(r.DisplayName, r.ResourceType));
                }
                specialSlots.Add(sunday);


    And this is my Xaml

      <telerik:RadScheduleView x:Name="MainSchedule" Grid.Row="2" Margin="2" TimeMarkersSource="{Binding TimeMarkers}"
                    CategoriesSource="{Binding Categories}" telerik:StyleManager.Theme="Metro" MinAppointmentHeight="10"
                    NavigationHeaderVisibility="Collapsed" AppointmentsSource="{Binding Appointments}" FirstVisibleTime="00:00:00"
                    SpecialSlotStyleSelector="{StaticResource SpecialSlotStyleSelector}"
                    SpecialSlotsSource="{Binding Slots}"
                    ResourceTypesSource="{Binding ResourceTypes}" IsInlineEditingEnabled="False" SnapAppointments="True"
                    CurrentDate="{Binding ElementName=TimeBar, Path=SelectionStart}" ToolTipTemplate="{StaticResource AppointmentToolTipTemplate}"
                    >
                <telerik:RadScheduleView.DragDropBehavior>
                    <providers:ITCalendarDragDropBehaviour />
                </telerik:RadScheduleView.DragDropBehavior>
                    <telerik:RadScheduleView.ActiveViewDefinition >
                    <telerik:TimelineViewDefinition MinTimeRulerExtent="1" MaxTimeRulerExtent="Infinity"
                            VisibleDays="{Binding ElementName=TimeBar, Path=Selection, Converter={StaticResource VisibleDaysConverter}}"
                            StretchAppointments="True" StretchGroupHeaders="True" ShowTimeRuler="True"
                             TimerulerMajorTickStringFormat="{}{0:%D}"        
                              TimerulerMinorTickStringFormat="{}{0:%D}"    
                                TimerulerGroupStringFormat="{}{0:MM/dd}">

                        <telerik:TimelineViewDefinition.MajorTickLength>
                            <telerik:FixedTickLengthProvider TickLength="1.0:0:0"  />
                        </telerik:TimelineViewDefinition.MajorTickLength>
                        <telerik:TimelineViewDefinition.MinorTickLength>
                            <telerik:FixedTickLengthProvider TickLength="1.0:0:0"/>
                        </telerik:TimelineViewDefinition.MinorTickLength>

                    </telerik:TimelineViewDefinition>

                </telerik:RadScheduleView.ActiveViewDefinition>
                
                <telerik:RadScheduleView.AppointmentItemContentTemplate>
                    <DataTemplate>
                   
                            <StackPanel Margin="4 2">
                            <TextBlock Text="{Binding Subject}" FontWeight="Bold" FontSize="9" />
                            <TextBlock Text="{Binding Appointment.Body}" TextWrapping="Wrap" FontSize="9"/>
                        </StackPanel>
                    </DataTemplate>
                   
                    
                </telerik:RadScheduleView.AppointmentItemContentTemplate>
                <telerik:RadScheduleView.GroupDescriptionsSource>
                    <telerik:GroupDescriptionCollection>
                        <telerik:ResourceGroupDescription ResourceType="People" />
                    </telerik:GroupDescriptionCollection>
                </telerik:RadScheduleView.GroupDescriptionsSource>
                <telerik:RadScheduleView.GroupHeaderContentTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding FormattedName}" Width="100" Margin="8 0" VerticalAlignment="Center" />
                    </DataTemplate>
                </telerik:RadScheduleView.GroupHeaderContentTemplate>
         
                <telerik:RadScheduleView.TimeRulerItemStyleSelector>
                    <providers:GroupItemStyleSelector>
                        <providers:GroupItemStyleSelector.DefaultStyle>
                            <Style TargetType="Control">
                                <Setter Property="Width" Value="1" />
                                <Setter Property="Height" Value="0" />
                            </Style>
                        </providers:GroupItemStyleSelector.DefaultStyle>
                        <providers:GroupItemStyleSelector.GroupItemStyle>
                            <Style TargetType="telerik:TimeRulerGroupItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="telerik:TimeRulerGroupItem">
                                            <Border BorderBrush="{StaticResource BasicBrush}" BorderThickness="1 1 0 0">
                                                <ContentPresenter Margin="4 2" />
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </providers:GroupItemStyleSelector.GroupItemStyle>
                        <providers:GroupItemStyleSelector.TimeRulerLineStyle>
                            <Style TargetType="Control">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Control">
                                            <Border BorderBrush="{StaticResource BasicBrush}" BorderThickness="1 0 0 0" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </providers:GroupItemStyleSelector.TimeRulerLineStyle>
                        </providers:GroupItemStyleSelector>
                </telerik:RadScheduleView.TimeRulerItemStyleSelector>
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu  x:Name="contextMenu" IsOpen="{Binding IsContextMenuOpen, Mode=TwoWay}" >
                        <telerik:RadMenuItem Header="Switch Location" x:Name="rmiSwitchLocation"
                                Command="{Binding SwitchLocationCommand}"
                                CommandParameter="{Binding Menu.UIElement.SelectedAppointments, RelativeSource={RelativeSource Self}}"
                                             ItemsSource="{Binding Categories}">

                            <telerik:RadMenuItem.ItemTemplate>
                            <DataTemplate >
                                <StackPanel Orientation="Horizontal">
                                        <Border Background="{Binding Path=CategoryBrush}" Width="16" />
                                        <TextBlock  Text="{Binding Path=CategoryName}" Margin="2 0 0 0" />
                                </StackPanel>
                            </DataTemplate>
                            </telerik:RadMenuItem.ItemTemplate>
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem IsSeparator="True" x:Name="rmiSwitchLocationSeparator" />
                        <telerik:RadMenuItem Header="Create..." x:Name="rmiCreate" ItemsSource="{Binding Categories}">
                            <telerik:RadMenuItem.ItemTemplate>
                                <DataTemplate >
                                    <StackPanel Orientation="Horizontal">
                                        <Border Background="{Binding Path=CategoryBrush}" Width="16" />
                                        <TextBlock  Text="{Binding Path=CategoryName}" Margin="2 0 0 0" />
                                    </StackPanel>
                                </DataTemplate>
                            </telerik:RadMenuItem.ItemTemplate>
                        </telerik:RadMenuItem>
                        <!--<telerik:RadMenuItem Header="Create Schedule..." CommandTarget="{Binding Menu.UIElement, RelativeSource={RelativeSource Self}}"
                                Command="telerik:RadScheduleViewCommands.CreateAppointment"  />
                        <telerik:RadMenuItem Header="Open..." CommandTarget="{Binding Menu.UIElement, RelativeSource={RelativeSource Self}}"
                                Command="telerik:RadScheduleViewCommands.EditAppointment" />-->
                        <telerik:RadMenuItem Header="Delete" x:Name="rmiDelete" CommandTarget="{Binding Menu.UIElement, RelativeSource={RelativeSource Self}}"
                                Command="telerik:RadScheduleViewCommands.DeleteAppointment" />

                        <!--<telerik:RadMenuItem IsSeparator="True" x:Name="rmiCreateDeleteSeparator" />-->

                    
                    
                    </telerik:RadContextMenu>
                </telerik:RadContextMenu.ContextMenu>
            </telerik:RadScheduleView>
  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 20 Dec 2011 Link to this post

    Hi Freeport,

    I suggest you edit the code for adding resources to the slot like it is shown below:

    OLD
    sunday.Resources.Add(new Resource(r.DisplayName, r.ResourceType));

    NEW
    sunday.Resources.Add(new Resource(r.ResourceName, r.ResourceType));


    All the best,
    Rosi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Freeport LNG Development
    Freeport LNG Development avatar
    8 posts
    Member since:
    Apr 2010

    Posted 30 Dec 2011 Link to this post

    Thank you for your response.
    Unfortunately that does not help, The ResourceName and DisplayName are the same value.

    I am running out of ideas to try

  5. Freeport LNG Development
    Freeport LNG Development avatar
    8 posts
    Member since:
    Apr 2010

    Posted 30 Dec 2011 Link to this post

    Hello

    I have submitted a support request where i could attach an example project.
    The ticket can be found here: http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=497083

    Thanks
  6. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 03 Jan 2012 Link to this post

    Hi,

    Thank you  for the provided project.

    To work everything as expected, please change the implementations of SaturdayOccurence and SundayOccurence classes as they are shown here.

    Kind regards,
    Rosi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Freeport LNG Development
    Freeport LNG Development avatar
    8 posts
    Member since:
    Apr 2010

    Posted 03 Jan 2012 Link to this post

    Thank you .. this works great!
  8. Jason
    Jason avatar
    1 posts
    Member since:
    May 2010

    Posted 14 Feb 2012 Link to this post

    The resolution link is now gone.. What was the needed change to those classes in order for the special slots to appear when grouping?   I have the same issue apparently.   Thank you.
  9. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 15 Feb 2012 Link to this post

    Hello,

    I suggest you try implement Copy and CopyFrom methods as it is shown in our documentation.

    Greetings,
    Rosi
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  10. Lucie
    Lucie avatar
    28 posts
    Member since:
    Jun 2011

    Posted 25 May 2012 Link to this post

    I have the same problem. I use special slots to change background of slots for weekend days, holidays and so on. I have special slots for it and have implemented ScheduleViewStyleSelector / SelectStyle and defined templates with different colors for background.

    It works fine without grouping but not for grouping. Adding of Copy and CopyFrom to special slots does not help me.

    I add breakpoints to program and I have found that when grouping is on then is never called SelectStyle (without grouping it is called as expected). There is called only Copy for Slots.

    When should be filled collection of special slots? Before adding of appointment or after?

    Is possible restore link for sample ClientsFiles/317515_slots.zip (see above) or send me another link for running sample?

    Is there another way to change background color for slots?

     

    Regards

  11. Lucie
    Lucie avatar
    28 posts
    Member since:
    Jun 2011

    Posted 25 May 2012 Link to this post

    I have solved this problem now.

    I have forgotten set resource for instances of special slot when grouping was on.

     

    Regards

Back to Top
DevCraft banner