We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Resource is not applying when templating ScheduleMonthDateContentControl

Hi, Team

Based on your help with https://www.syncfusion.com/forums/141822/how-can-i-increase-the-number-of-items-appointments-in-monthviewitem

Templating Monthviewitem seems look ok.

But if I need to apply my resource collection (i.e by location) onto the calendar, my appointments displays every resources in Month view, not on the specified resource..

I look forward to hearing that your team found the solution with the problem of what you provided before.

James



7 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team January 18, 2019 11:26 AM UTC

                      
Thanks for contacting Syncfusion support, 
  
We have analyzed the reported query “Resource is not applying when templating ScheduleMonthDateContentControl” based on the sample we have shared in the forum. In the sample, we have passed the overall appointment collection to listview and filter the current date collection based on date manually in converter, hence the appointments didn’t arrange based on resource. Now we have passed the appointments to list view from Appointment’s property of MonthViewItem in schedule and it will arrange based on resource in month view. 
 
Please refer the following code example for the same, 
  
[XAML] 
<ListView Grid.Row="1" Background="{TemplateBinding Background}"BorderBrush="Transparent"> 
                                    <ListView.ItemsSource> 
                                        <MultiBinding Converter="{StaticResource AppoitmentConverter}"> 
                                            <Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Typesyncfusion:MonthViewItem}, AncestorLevel=1}" Path="Appointments"/> 
                                            <Binding Path="Date"RelativeSource="{RelativeSource Mode=TemplatedParent}"/> 
                                        </MultiBinding> 
                                    </ListView.ItemsSource> 
                                    <ListView.ItemTemplate> 
                                        <DataTemplate> 
                                            <WrapPanel> 
                                                <TextBlock Background="{Binding AppointmentBackground}" Text="{Binding Path=Subject}"Foreground="White"/> 
                                            </WrapPanel> 
                                        </DataTemplate> 
                                    </ListView.ItemTemplate> 
                                </ListView> 
  
[C#] 
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 
        { 
            Appointments = new ScheduleAppointmentCollection(); 
            var VisibleAppointments = values[0] asScheduleAppointmentCollection; 
            var Date = values[1] as DateTime?; 
  
            if (VisibleAppointments == null || VisibleAppointments?.Count == 0) 
                return Appointments; 
  
            for (int i = 0; i < VisibleAppointments.Count; i++) 
            { 
                    if (VisibleAppointments[i].StartTime.Date.Equals(Date)) 
                        Appointments.Add(VisibleAppointments[i]); 
            } 
            return Appointments; 
        } 
 We have prepared a sample for the same, please find the sample by the following link. 
  
Sample: SfSchedule. 
  
We hope that this helps you, kindly revert us if you have any concern. 
  
Regards,
Subburaj Pandian V  



JA James January 21, 2019 11:57 PM UTC

Hi, Subburaj

Thanks for your reply.

But,, your solution has gone back to the original issue.

If you have a look on the conversation again in https://www.syncfusion.com/forums/141822/how-can-i-increase-the-number-of-items-appointments-in-monthviewitem,
there was a issue that MonthView has some limitation of appointments on display, which is just 3...and your team gave me some solution for that.

but your solution with the sample on this thread, which is
<Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Typesyncfusion:MonthViewItem}, AncestorLevel=1}" Path="Appointments"/> 
                                            <Binding Path="Date"RelativeSource="{RelativeSource Mode=TemplatedParent}"/> 

Came back to the original issue.
To replicate the problem, you can increase number of the appointments in this sample, then you will see you cannot have the full list of appointments..

I look forward to hearing your comment

James


SP Subburaj Pandian Veluchamy Syncfusion Team January 22, 2019 11:41 AM UTC

Hi James, 
  
Thank you for the update. 
  
Based on the provided information, we have analyzed your query and we suggested you to use Appointments parameter only when using the Resource for schedule. On this scenario it will return all the available appointments for the month cell, but in normal scenarios like without resource we have restricted the appointments count inside our source. Hence it will return only three appointments and for that scenario, we have suggested you to pass the local appointments collection and get the current visible appointments by using the converter. 
  
We hope that this helps you, kindly revert us if you have any concern. 
  
Regards,
Subburaj Pandian V  



JA James January 22, 2019 02:03 PM UTC

Hi, Subburaj

Thanks for your quick review. But I think I am not understanding what you are exactly trying to say. Maybe because I was referencing Forum section, not just using this thread. My apologies.

Based on what you said at just your last comment;

=> Based on the provided information, we have analyzed your query and we suggested you to use Appointments parameter only when using the Resource for schedule. On this scenario it will return all the available appointments for the month cell, 

=> No, it is not true. Passing Appointments parameter using Resource for the schedule DOES NOT return all the appointments. There is limit (Max. 3) on this parameter on your sample project. This is what I was complaining on this thread initially.

Ok. let me explain it again. What I am experiencing is,,

Passing Appointments from ViewModel to the converter (Your first sample at forum/141822)
-> Yes, it DOES return all the appointments. BUT It is IGNORE the resource set. My appointments are not distributing according to the resource. just display every resources.

Passing Appointments from MonthViewItem (AncestorLev=1) to the converter (Your second answer at this thread)
=> Yes, It DOES apply resource set, BUT it DOES NOT return all the appoinments, but just 3 maximum for the day.

In brief, My original request is,

Is it possible for the sfScheduler (MonthView, especially) to have

All the appointments (not, just 3....) in month cell USING resource.. 

Please let me know if I am making you confused.

Regards
James



SP Subburaj Pandian Veluchamy Syncfusion Team January 23, 2019 06:01 AM UTC

Hi James, 
  
Thank you for the update. 
  
We have analyzed your query “Need to display more than three appointments on month cell, when resource used in schedule” and the sample we given in our earlier update is working fine for this scenario. You can pass Appointments from MonthViewItem to converter, it will return all the available appointments for the Monthcell. We have added more appointments in the sample we have added 8 appointments for a particular resource in particular cell and 7 appointments for another resource and particular cell and it displays all the available appointments in the list view. We have prepared the sample based on this and output video for the same. 
  
Sample and Video: Schedule 
  
We hope that this helps you, kindly revert us by modifying the sample, if doesn’t match your requirement. 
  
Regards,
Subburaj Pandian V  
 



JA James January 24, 2019 01:01 AM UTC

Hi Subburaj

Aha.....Now I understand.. I understood in a different way..

In order to show all appointments,
  ->      With Resource: pass Appointments from MonthViewItem to the converter
  -> Without Resource: pass Appointments from ViewModel bindings to the converter

Now, it make sense....

Thanks for your advice, and for your acceptance of my frequent questions.

Thank you
James





SP Subburaj Pandian Veluchamy Syncfusion Team January 24, 2019 05:26 AM UTC

Hi James, 
 
Thank you for the update.  
 
We are happy that the given solution meets your requirement. 
 
Regards,
Subburaj Pandian V  


Loader.
Up arrow icon