Ease Resource Allocation Using The Scheduler Resource View In Wpf

Sample date Updated on Feb 15, 2024
appointments calendar events resource resource-allocation resource-group resources scheduler

You can easily manage and allocate the resources in a calendar view by controlling the project tasks, time sheets, and employee’s availability in a manual approach by using scheduler resource view.

Resource Grouping

You can allocate the tasks to the employees either by date basis with the available resource or resource basis with the available dates by using the ResourceGroupType API in Scheduler class.

Resource sharing

You are free to assign as many resources as you wish to a task by assigning the Id of the resources in ResourceIdCollection API of the ScheduleAppointment class.

Data binding

You can create custom resource model with required field and it can be mapped to the equivalent properties in the ResourceMapping API in scheduler class.

Task reassignment

You can easily create, edit or delete the task dynamically using build in editor support, drag and drop support and appointment resizing support in Scheduler control.

Resource availability

You can easy manage and track the absence and unavailability of the resources by using the SpecialTimeRegions support,

/// <summary>   
/// Represents custom data properties.   
/// </summary> 
public class Employee
{
    public string Name { get; set; }
    public object ID { get; set; }
    public Brush BackgroundBrush { get; set; }
    public Brush ForegroundBrush { get; set; }
}
SpecialTimeRegion timeRegion = new SpecialTimeRegion();
timeRegion.Text = "Casual leave"
timeRegion.StartTime = new DateTime(currentDate.Year, currentDate.Month, currentDate.AddDays(2).Day, 0, 0, 0);
timeRegion.EndTime = new DateTime(currentDate.Year, currentDate.Month, currentDate.AddDays(3).Day, 0, 0, 0);
timeRegion.Background = new SolidColorBrush(Color.FromRgb(245, 245, 245));
timeRegion.ResourceIdCollection = new ObservableCollection<object>() { "1" };
scheduler.DaysViewSettings.SpecialTimeRegions = new ObservableCollection<SpecialTimeRegion>() { timeRegion };
        <syncfusion:SfScheduler ViewType="WorkWeek"
                                ResourceGroupType="Resource"
                                ItemsSource="{Binding Tasks}">
            <syncfusion:SfScheduler.ResourceMapping>
                <syncfusion:ResourceMapping 
                    Id="ID" 
                    Name="Name" 
                    Background="BackgroundBrush" 
                    Foreground="ForegroundBrush"/>
            </syncfusion:SfScheduler.ResourceMapping>
            <syncfusion:SfScheduler.ResourceCollection>
                <local:SchedulerResourceCollection>
                    <local:Employee Name="Sophia" ID="1" ForegroundBrush="White" BackgroundBrush="#9d65c9" />
                    <local:Employee Name="Kinsley Elena" ID="2" ForegroundBrush="White" BackgroundBrush="#f08a5d" />
                    <local:Employee Name="Adeline Ruby" ID="3" ForegroundBrush="White" BackgroundBrush="#679b9b" />
                </local:SchedulerResourceCollection>
            </syncfusion:SfScheduler.ResourceCollection>
        </syncfusion:SfScheduler>

Output

SchedulerResourceView

Customization

Scheduler resource view allows you to create different colors or even different views for resource view by using data templates and data-template selector support with ResourceHeaderTemplate and ResourceHeaderTemplateSelector APIs in scheduler class.

            <syncfusion:SfScheduler.ResourceHeaderTemplate>
                <DataTemplate>
                    <Grid Background="Transparent">
                        <StackPanel VerticalAlignment="Center" Orientation="Vertical">
                            <Border CornerRadius="36" Height="72" Width="72" BorderThickness="4" BorderBrush="{Binding BackgroundBrush}">
                                <Border CornerRadius="36" Height="64" Width="64" BorderThickness="4" BorderBrush="Transparent">
                                    <Image HorizontalAlignment="Center" VerticalAlignment="Center"
                                   Width="55"
                                   Height="55"
                                   Source="{Binding ImageSource}" />
                                </Border>
                            </Border>
                            <TextBlock HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               FontSize="15"
                               Text="{Binding Name}"/>
                            <TextBlock HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               FontSize="15"
                               Text="{Binding Designation}"/>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </syncfusion:SfScheduler.ResourceHeaderTemplate>

Output

SchedulerTemplatedResourceView

Up arrow