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

Not showing slots with grouping

9 Answers 176 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Freeport LNG Development
Top achievements
Rank 1
Freeport LNG Development asked on 16 Dec 2011, 04:01 PM
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>

9 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 20 Dec 2011, 09:24 AM
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 >>

0
Freeport LNG Development
Top achievements
Rank 1
answered on 30 Dec 2011, 02:12 PM
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

0
Freeport LNG Development
Top achievements
Rank 1
answered on 30 Dec 2011, 04:28 PM
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
0
Rosi
Telerik team
answered on 03 Jan 2012, 09:48 AM
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 >>

0
Freeport LNG Development
Top achievements
Rank 1
answered on 03 Jan 2012, 02:21 PM
Thank you .. this works great!
0
Jason
Top achievements
Rank 1
answered on 15 Feb 2012, 12:16 AM
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.
0
Rosi
Telerik team
answered on 15 Feb 2012, 09:03 AM
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 >>
0
Lucie
Top achievements
Rank 1
answered on 25 May 2012, 08:31 AM

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

0
Lucie
Top achievements
Rank 1
answered on 25 May 2012, 12:08 PM

I have solved this problem now.

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

 

Regards

Tags
ScheduleView
Asked by
Freeport LNG Development
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Freeport LNG Development
Top achievements
Rank 1
Jason
Top achievements
Rank 1
Lucie
Top achievements
Rank 1
Share this question
or