MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SchedulerResourceView

    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 : BindableObject

    Constructors

    SchedulerResourceView()

    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.

    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.

    Properties

    HeaderTemplate

    Gets or sets the resource header template.

    Declaration
    public DataTemplate HeaderTemplate { get; set; }
    Property Value
    Type Description
    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 Description
    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;

    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 Description
    System.Object
    Remarks

    Scheduler supports displaying appointments in timeline views based on resources. Day, Week, WorkWeek, 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.

    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 Description
    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 Description
    SchedulerTextStyle
    Remarks

    TextColor will not be applicable as Foreground available in SchedulerResource.

    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved