menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SchedulerResourceView - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SchedulerResourceView

    Represents a class which is used to customize resource view of the scheduler.

    Inheritance
    System.Object
    SchedulerResourceView
    Namespace: Syncfusion.Maui.Scheduler
    Assembly: Syncfusion.Maui.Scheduler.dll
    Syntax
    public class SchedulerResourceView : Element, IThemeElement

    Constructors

    SchedulerResourceView()

    Initializes a new instance of the SchedulerResourceView class.

    Declaration
    public SchedulerResourceView()

    Fields

    HeaderTemplateProperty

    Identifies the HeaderTemplate dependency property.

    Declaration
    public static readonly BindableProperty HeaderTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for HeaderTemplate dependency property.

    MappingProperty

    Identifies the Mapping dependency property.

    Declaration
    public static readonly BindableProperty MappingProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Mapping dependency property.

    MinimumRowHeightProperty

    Identifies the MinimumRowHeight dependency property.

    Declaration
    public static readonly BindableProperty MinimumRowHeightProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for MinimumRowHeight dependency property.

    ResourceGroupTypeProperty

    Identifies the ResourceGroupType dependency property.

    Declaration
    public static readonly BindableProperty ResourceGroupTypeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for ResourceGroupType dependency property.

    ResourceHeaderHeightProperty

    Identifies the ResourceHeaderHeightProperty dependency property.

    Declaration
    public static readonly BindableProperty ResourceHeaderHeightProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    Identifies the ResourceHeaderHeightProperty bindable property.

    ResourcesProperty

    Identifies the Resources dependency property.

    Declaration
    public static readonly BindableProperty ResourcesProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Resources dependency property.

    SelectedResourceIdProperty

    Identifies the SelectedResourceId dependency property.

    Declaration
    public static readonly BindableProperty SelectedResourceIdProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SelectedResourceId dependency property.

    TextStyleProperty

    Identifies the TextStyle dependency property.

    Declaration
    public static readonly BindableProperty TextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TextStyle dependency property.

    VisibleResourceCountProperty

    Identifies the VisibleResourceCountProperty dependency property.

    Declaration
    public static readonly BindableProperty VisibleResourceCountProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    Identifies the VisibleResourceCountProperty bindable property.

    Properties

    HeaderTemplate

    Gets or sets the resource header template.

    Declaration
    public DataTemplate HeaderTemplate { get; set; }
    Property Value
    Type
    Microsoft.Maui.Controls.DataTemplate
    Remarks

    By default, the SchedulerResource is set as the BindingContext for HeaderTemplate for both SchedulerResource and custom data object in Resources. Custom data object can be bound in HeaderTemplate by using DataItem.

    Examples

    The following sample used to configure the custom resource and resource header template.

    # [Model.cs](#tab/tabid-8)
    public class Employee
    {
        public string Name { get; set; }
        public object Id { get; set; }
        public Brush BackgroundBrush { get; set; }
        public Brush ForegroundBrush { get; set; }
    }
    # [C#](#tab/tabid-9)
    var customResources = new ObservableCollection<Employee>();
    var employee = new Employee()
    {
       Name = "Jhon",
       Id = "1001",
       BackgroundBrush = Brush.GreenYellow,
       ForegroundBrush = Brush.Black,
    };
    customResources.Add(employee);
    this.scheduler.ResourceView.Resources = customResources;
    # [XAML](#tab/tabid-10)
    <ContentPage.Resources>
        <DataTemplate x:Key="resourceHeaderTemplate">
            <Grid Background="{Binding DataItem.BackgroundBrush}">
                <Label Text="{Binding DataItem.Name}" TextColor="{Binding DataItem.ForegroundBrush}"/>
            </Grid>
        </DataTemplate>
    </ContentPage.Resources>
    

    <syncfusion:SfScheduler x:Name="scheduler"> <syncfusion:SfScheduler.ResourceView> <syncfusion:SchedulerResourceView HeaderTemplate="{StaticResource resourceHeaderTemplate}"> <syncfusion:SchedulerResourceView.Mapping> <syncfusion:SchedulerResourceMapping Id = "Id" Name="Name" Background="BackgroundColor" Foreground="ForegroundColor"/> </syncfusion:SchedulerResourceView.Mapping> </syncfusion:SchedulerResourceView> </syncfusion:SfScheduler.ResourceView> </syncfusion:SfScheduler>

    Mapping

    Gets or sets the Resource Mapping that specifies data objects properties that provide values for SchedulerResource properties.

    Declaration
    public SchedulerResourceMapping Mapping { get; set; }
    Property Value
    Type
    SchedulerResourceMapping
    Remarks

    Custom resource class should contain a mandatory field for resource Id. For dynamic changes, custom resource should inherit from INotifyPropertyChanged. DataItem property is used to get the details of custom data.

    Examples

    #C#

    Create a custom class Employee with mandatory fields Name, Id, ForegroundColor and BackgroundColor.

    public class Employee
    {
       public string Name { get; set; }
       public string Id { get; set; }
       public Brush BackgroundColor { get; set; }
       public Brush ForegroundColor { get; set; }
    }
    #[C#](#tab/tabid-4)

    Add resources of Employee collection that can be assigned to scheduler using the Resources property which is of object type.

    public class MainViewModel
    {
        private ObservableCollection<Employee> resources;
        public ObservableCollection<Employee> Resources
        {
            get
            {
                return resources;
            }
            set
            {
                resources = value;
            }
            public ResourceViewModel()
            {
                Resources = new ObservableCollection<Employee>()
                {
                    new Employee() { Name = "Sophia", BackgroundColor = Brush.Red, Id = "1000",ForegroundColor = Brush.White },
                    new Employee() { Name = "Zoey Addison", BackgroundColor = Brush.Blue, Id = "1001",ForegroundColor = Brush.Red },
                    new Employee() { Name = "James William", BackgroundColor = Brush.Yellow, Id = "1002",ForegroundColor = Brush.Yellow },
                };
            }
        }
    }
    #[XAML](#tab/tabid-5)

    Map the properties of Employee class with SfScheduler control using Scheduler Mapping.

    <syncfusion:SfScheduler x:Name="Scheduler"
                            ViewType="TimelineWorkWeek">
        <syncfusion:SfScheduler.ResourceView>
           <syncfusion:SchedulerResourceView Resources="{Binding Resources}">
                <syncfusion:SchedulerResourceView.Mapping>
                    <syncfusion:SchedulerResourceMapping
                            Id = "Id"
                            Name="Name"
                            Background="BackgroundColor"
                            Foreground="ForegroundColor"/>
                </syncfusion:SchedulerResourceView.Mapping>
            </syncfusion:SchedulerResourceView>
        </syncfusion:SfScheduler.ResourceView>
    </syncfusion:SfScheduler>
    See Also
    SchedulerResource
    Resources
    AppointmentMapping
    ResourceView

    MinimumRowHeight

    Gets or sets a minimum row height value of a resource in the timeline views.

    Declaration
    public double MinimumRowHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is -1.

    Remarks

    By default, if the viewport height is greater than 400 then each resource height will be calculated by viewport size divided by the minimum value of scheduler resources count and 4 (default resource count). If the viewport height is lesser than 400 then each resource height will be calculated by default viewport size(4 (default resource*100)) divided by the minimum value of scheduler resources count and 4 (default resource count). If the MinimumRowHeight is less than the default row height then the default row height will be used. And resource row height will be auto-expanded from minimum height based on the appointment counts.

    Examples
    • XAML
    • C#
    <syncfusion:SfScheduler x:Name="Scheduler">
    <syncfusion:SfScheduler.ResourceView>
    <syncfusion:SchedulerResourceView MinimumRowHeight= "150"/>
    </ syncfusion:SfScheduler.ResourceView>
    </syncfusion:SfScheduler>
    this.Scheduler.ResourceView.MinimumRowHeight= 150;

    ResourceGroupType

    Gets or sets the resource group type for the horizontal resource view.

    Declaration
    public SchedulerResourceGroupType ResourceGroupType { get; set; }
    Property Value
    Type Description
    SchedulerResourceGroupType

    The default value is Resource.

    Remarks

    This property is applicable only on Windows and macOS platforms.

    Examples
    • XAML
    • C#
    <syncfusion:SfScheduler x:Name="Scheduler">
    <syncfusion:SfScheduler.ResourceView>
    <syncfusion:SchedulerResourceView ResourceGroupType= "Date"/>
    </ syncfusion:SfScheduler.ResourceView>
    </syncfusion:SfScheduler>
    this.Scheduler.ResourceView.ResourceGroupType = SchedulerResourceGroupType.Date;

    ResourceHeaderHeight

    Gets or sets the height of the resource header when resources are arranged horizontally. Typically used in Day, Week, and WorkWeek views.

    Declaration
    public double ResourceHeaderHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is -1.

    Remarks

    When the default value is -1, the resource header height will be rendered as 56.

    Examples
    • XAML
    • C#
    <syncfusion:SfScheduler x:Name="Scheduler">
    <syncfusion:SfScheduler.ResourceView>
    <syncfusion:SchedulerResourceView ResourceHeaderHeight="100"/>
    </ syncfusion:SfScheduler.ResourceView>
    </syncfusion:SfScheduler>
    this.Scheduler.ResourceView.ResourceHeaderHeight = 100;

    Resources

    Gets or sets the resources that have been added to the scheduler to display the appointments that are grouped under that resource.

    Declaration
    public object Resources { get; set; }
    Property Value
    Type
    System.Object
    Remarks

    Scheduler supports displaying appointments in timeline views and day views based on resources. Month and Agenda views shows appointments without grouping. When the Resources have the items of type other than SchedulerResource, then scheduler uses Mapping to map SchedulerResource properties and custom class fields. The resource view functionality for Day-based views (Day, Week, and Work Week) is supported only on windows and macOS platforms.

    Examples

    #Xaml

    <syncfusion:SfScheduler x:Name="Scheduler"
                            View="TimelineWeek"/>

    #C#

    var schedulerResources = new ObservableCollection<SchedulerResource>()
    {
    new SchedulerResource() { Name = "Sophia", Background = Brush.Red, Id = "1000" },
    new SchedulerResource() { Name = "Zoey Addison", Background = Brush.Blue, Id = "1001" },
    new SchedulerResource() { Name = "James William", Background = Brush.Yellow, Id = "1002" },
    };
    this.Scheduler.ResourceView.Resources = schedulerResources;
    See Also
    Mapping
    SchedulerResource

    SelectedResourceId

    Gets or sets the selected resource id to programmatically select a specific resource.

    Declaration
    public object SelectedResourceId { get; set; }
    Property Value
    Type
    System.Object
    Remarks

    SelectedDate and SelectedResourceId must be set to select a specific resource and its time slot.

    Examples
    • XAML
    <schedule:SfScheduler x:Name="Scheduler"
                          View="TimelineMonth">
    </schedule:SfScheduler>

    #C#

    var schedulerResources = new ObservableCollection<SchedulerResource>()
    {
    new SchedulerResource() { Name = "Sophia", Background = Brush.Red, Id = "1000" },
    new SchedulerResource() { Name = "Zoey Addison", Background = Brush.Blue, Id = "1001" },
    new SchedulerResource() { Name = "James William", Background = Brush.Yellow, Id = "1002" },
    };
    this.Scheduler.ResourceView.Resources = schedulerResources;
    this.Scheduler.ResourceView.SelectedResourceId = "1001";
    this.Scheduler.SelectedDate = DateTime.Now;

    TextStyle

    Gets or sets the text style of the resource header.

    Declaration
    public SchedulerTextStyle TextStyle { get; set; }
    Property Value
    Type
    SchedulerTextStyle
    Remarks

    TextColor will not be applicable as Foreground available in SchedulerResource.

    VisibleResourceCount

    Gets or sets the number of visible resources in the resource view.

    Declaration
    public int VisibleResourceCount { get; set; }
    Property Value
    Type Description
    System.Int32

    The default value is -1.

    Remarks

    This property is applicable only to the horizontal resource view on Windows and macOS platforms. When the default value is -1, the horizontal resource view will render three resources by default.

    Examples
    • XAML
    • C#
    <syncfusion:SfScheduler x:Name="Scheduler">
    <syncfusion:SfScheduler.ResourceView>
    <syncfusion:SchedulerResourceView VisibleResourceCount="1"/>
    </ syncfusion:SfScheduler.ResourceView>
    </syncfusion:SfScheduler>
    this.Scheduler.ResourceView.VisibleResourceCount = 1;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved