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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get Name or Index of currently selected Resource.

Thread ID:

Created:

Updated:

Platform:

Replies:

127922 Dec 19,2016 09:53 AM UTC Dec 21,2016 05:13 AM UTC WPF 4
loading
Tags: Schedule
Andrzej
Asked On December 19, 2016 09:53 AM UTC

I use two Resource Types with several resources in each type. When adding new appointment through context menu, need to know a name of a resource on which mouse was clicked, to use it in:

appointment.ResourceCollection.Add(new Resource()

{

ResourceName = "Symbol1",

TypeName = "Symbols"

});

Knowing ResourceName is required while adding new appointment under particular resource, otherwise appointment is not displayed.

When I add a new appointment from code behind with: ResourceName = "Symbol1", TypeName = "Symbols" 

then appointment is properly displayed.

For the project I used Custom Appointment Editor from CustomizationDemo.

I checked ScheduleResourcePagerWithExpander but there is no pointer how to get the name or index.

Thanks in advance.


Andrzej
Replied On December 19, 2016 10:44 PM UTC

I use two Resource Types with several resources in each type. When adding new appointment through context menu, need to know a name of a resource on which mouse was clicked, to use it in:

appointment.ResourceCollection.Add(new Resource()

{

ResourceName = "Symbol1",

TypeName = "Symbols"

});

Knowing ResourceName is required while adding new appointment under particular resource, otherwise appointment is not displayed.

When I add a new appointment from code behind with: ResourceName = "Symbol1", TypeName = "Symbols" 

then appointment is properly displayed.

For the project I used Custom Appointment Editor from CustomizationDemo.

I checked ScheduleResourcePagerWithExpander but there is no pointer how to get the name or index.

Thanks in advance.


It seems that Custom Appointment Editor from CustomizationDemo doesn't automatically add appointments to appropriate resources.
Regular Appointment Editor in ResourceDemo adds new appointments to selected resources without any additional help.
Please advise.

Jeyasri M [Syncfusion]
Replied On December 20, 2016 11:03 AM UTC

Hi Andrzej, 
 
Thanks for your interest in Syncfusion products. 
 
By using the SfSchedule AppointmentEditorOpening event you can get the selected Resource details. Based on your requirement we have modified the Customization sample and please find the sample from below link. 
 
In the above sample, we have used AppointmentEditorOpening event to get the selected Resource details and corresponding ResourceCollection has been added while creating newly appointment. 
 
Please find the modified Code Snippet as follows. 
 
Code Snippet: 
 
    void Schedule_AppointmentEditorOpening(object sender, AppointmentEditorOpeningEventArgs e) 
        { 
            e.Cancel = true; 
            AddDataContext = new BindingClass() {CurrentSelectedDate = e.StartTime, Appointment = e.Appointment,}; 
            SelectedResource = new ObservableCollection<object>(); 
 
            foreach (var item in e.SelectedResource) 
                SelectedResource.Add(item); 
            ……………… 
        } 
 
Regards, 
Jeyasri M.

 


Andrzej
Replied On December 20, 2016 02:44 PM UTC

Provided solution solved the problem. Thank you for fast response and excellent support.

Jeyasri M [Syncfusion]
Replied On December 21, 2016 05:13 AM UTC

Hi Andrzej,  
 
We value your feedback and we glad to know that the given solution worked for you. Please let us know if you need any further assistance. 
 
Regards, 
Jeyasri M. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;