Articles in this section
Category / Section

How to enable resource and create appointments under it in WPF Schedule?

4 mins read

In WPF Schedule control, you can easily enable Resource and create appointments under it. Here Resource is used to add additional information about the appointments.

For enabling Resource in SfSchedule

Create a WPF application and add SfSchedule control to it. Now, add resource type in ScheduleResourceTypeCollection as follows.

XAML

<syncfusion:SfSchedule.ScheduleResourceTypeCollection >
<syncfusion:ResourceType TypeName="Doctors">
<syncfusion:Resource
DisplayName="Dr. Jacob" ResourceName="Jacob"/>
<syncfusion:Resource
DisplayName="Dr. Darsy" ResourceName="Darsy"/>
</syncfusion:ResourceType>
</syncfusion:SfSchedule.ScheduleResourceTypeCollection>

 

Note:

In the above code example, only one ResourceType under ScheduleResourceTypeCollection property is added. It is also possible to add more than one resource types. But only one resource type can be viewed in SfSchedule by specifying the corresponding ResourceType name to Resource property of SfSchedule, as follows.

XAML

<syncfusion:SfSchedule ScheduleType="WorkWeek"
Name="schedule"    Resource="Doctors" >
</syncfusion:SfSchedule>

Now add the appointments in schedule under the specific resource by using ResourceCollection property of it, as follows.

 C#

DateTime currentdate = DateTime.Now.Date;
ScheduleAppointment app = new ScheduleAppointment()
{
StartTime = currentdate,
EndTime = currentdate.AddHours(2),
Subject = "Meeting",
Location = "Chennai",
AppointmentBackground = new
SolidColorBrush(Colors.Red)
};
app.ResourceCollection.Add(new Resource() { ResourceName
=
"Jacob", TypeName = "Doctors" });
ScheduleAppointment app1 = new ScheduleAppointment()
{
StartTime = currentdate,
EndTime = currentdate.AddHours(3),
Subject = "conference",
Location = "Chennai",
AppointmentBackground = new
SolidColorBrush(Colors.Red)
};
app.ResourceCollection.Add(new Resource() { ResourceName
=
"Darsy", TypeName = "Doctors" });
this.schedule.Appointments.Add(app);
this.schedule.Appointments.Add(app1);

In the above code, the Resource information of the appointment using ResourceCollection is specified, by adding the Resource information such as ResourceName and the TypeName (ResourceType name) where it exist.

The following screenshot displays the resource with appointment in Day View.

C:\Users\sangavi\Pictures\Screenshots\Screenshot (23).png

Figure 1: Resource in Day View

The following screenshot displays the resource with appointment in Month View.

 

 



C:\Users\sangavi\Pictures\Screenshots\Screenshot (22).png

Figure 2: Resource in Month View

The following screenshot displays the resource with appointment in TimeLine View.

C:\Users\sangavi\Pictures\Screenshots\Screenshot (24).png

Figure 3: Resource in TimeLine View

The following screenshot displays the resource with appointment in Week View.

C:\Users\sangavi\Pictures\Screenshots\Screenshot (25).png

Figure 4: Resource in Week View


Conclusion

I hope you enjoyed learning about how to enable resource and create appointments under it in WPF Schedule.

You can refer to our WPF Schedule feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Schedule example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!



Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied