menu

MAUI

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

    Show / Hide Table of Contents

    Class SchedulerHeaderView

    Represents a class which is used to customize all the properties of header settings of the sfscheduler.

    Inheritance
    System.Object
    SchedulerHeaderSettingsBase
    SchedulerHeaderView
    Inherited Members
    SchedulerHeaderSettingsBase.Height
    SchedulerHeaderSettingsBase.HeightProperty
    Namespace: Syncfusion.Maui.Scheduler
    Assembly: Syncfusion.Maui.Scheduler.dll
    Syntax
    public class SchedulerHeaderView : SchedulerHeaderSettingsBase, IThemeElement

    Constructors

    SchedulerHeaderView()

    Initializes a new instance of the SchedulerHeaderView class.

    Declaration
    public SchedulerHeaderView()

    Fields

    BackgroundProperty

    Identifies the Background dependency property.

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

    The identifier for Background dependency property.

    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.

    TextFormatProperty

    Identifies the TextFormat dependency property.

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

    The identifier for TextFormat 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

    Background

    Gets or sets the header background to customize the default background of the header in the scheduler.

    Declaration
    public Brush Background { get; set; }
    Property Value
    Type
    Microsoft.Maui.Controls.Brush
    Remarks

    It will be applicable to all View.

    Examples

    The below examples shows, how to set the Background property of the SchedulerHeaderView in the SfScheduler.

    this.Scheduler.HeaderView.Background = Brush.Blue;
    See Also
    TextFormat
    TextStyle
    Height

    HeaderTemplate

    Gets or sets the header view template or template selector.

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

    The BindingContext of the HeaderTemplate is the SchedulerHeaderDetails.

    Examples

    The following sample used to configure header view using the Microsoft.Maui.Controls.DataTemplate.

    # [XAML](#tab/tabid-1)
    <scheduler:SfScheduler x:Name="Scheduler"
                           View="Week">
       <scheduler:SfScheduler.HeaderView>
           <scheduler:SchedulerHeaderView>
             <scheduler:SchedulerHeaderView.HeaderTemplate>
               <DataTemplate>
                 <Grid Background = "LightBlue">
                     <Label x:Name="label" HorizontalOptions="Start" VerticalOptions="Center">
                     <Label.Text>
                        <MultiBinding StringFormat = "{}{0:MMM dd, yyyy} - {1:MMM dd, yyyy}">
                          <Binding Path="StartDate" />
                          <Binding Path = "EndDate" />
                       </MultiBinding>
                     </Label.Text>
                     </Label>
                   <Label  HorizontalOptions="Start" VerticalOptions="End" Text="{Binding Text}" TextColor="Red" />
                 </Grid>
           </DataTemplate>
         </scheduler:SchedulerHeaderView.HeaderTemplate>
        </scheduler:SchedulerHeaderView>
     </scheduler:SfScheduler.HeaderView>
    </scheduler:SfScheduler>

    The following sample used to configure header view using the Microsoft.Maui.Controls.DataTemplateSelector.

    # [DataTemplateSelector](#tab/tabid-2)
    public class HeaderTemplateSelector : DataTemplateSelector
    {
       public HeaderTemplateSelector()
       {
       }
       public DataTemplate TodayDatesTemplate { get; set; }
       public DataTemplate NormaldatesTemplate { get; set; }
       protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
       {
           var headerDetails = item as SchedulerHeaderDetails;
           if (headerDetails != null)
            {
               if (headerDetails.StartDate.Date <= DateTime.Now.Date && headerDetails.EndDate >= DateTime.Now.Date)
                   return TodayDatesTemplate;
            }
           return NormaldatesTemplate;
        }
    }
    # [Resources](#tab/tabid-3)
    <ContentPage.Resources>
       <DataTemplate x:Key="todayDatesTemplate">
       <Grid Background = "LightBlue" >
         <Label x:Name="label" HorizontalOptions="Start" VerticalOptions="Center">
          <Label.Text>
              <MultiBinding StringFormat = "{}{0:MMM dd, yyyy} - {1:MMM dd, yyyy}" >
                    <Binding Path="StartDate" />
                     <Binding Path = "EndDate" />
               </MultiBinding >
           </Label.Text >
          </Label >
         <Label  HorizontalOptions="Start" VerticalOptions="End" Text="{Binding Text}" TextColor="Red" />
        /Grid>
       </DataTemplate>
       <DataTemplate x:Key="normaldatesTemplate">
           <Grid Background = "LightGreen" >
               < Label x:Name="label" HorizontalOptions="Start" VerticalOptions="Center">
                   <Label.Text>
                       <MultiBinding StringFormat = "{}{0:MMM dd, yyyy} - {1:MMM dd, yyyy}" >
                           <Binding Path="StartDate" />
                           <Binding Path = "EndDate" />
                       </MultiBinding >
                   </Label.Text >
               </Label>
               <Label  HorizontalOptions="Start" VerticalOptions="End" Text="{Binding Text}" TextColor="Orange" />
           </Grid>
       </DataTemplate>
      <local:HeaderTemplateSelector x:Key="headerTemplateSelector" TodayDatesTemplate="{StaticResource todayDatesTemplate}"  NormaldatesTemplate="{StaticResource normaldatesTemplate}" />
    </ContentPage.Resources>
    #[MainPage](#tab/tabid-4)
    <scheduler:SfScheduler x:Name="Scheduler"
                           View="Week">
       <scheduler:SfScheduler.HeaderView>
           <scheduler:SchedulerHeaderView HeaderTemplate = "{StaticResource headerTemplateSelector}" />
      </scheduler:SfScheduler.HeaderView>
    </scheduler:SfScheduler>

    TextFormat

    Gets or sets the text format to customize the default text format property of the header in the scheduler.

    Declaration
    public string TextFormat { get; set; }
    Property Value
    Type
    System.String
    Remarks

    It will be applicable to all View.

    Examples

    The below examples shows, how to use the TextFormat of the SchedulerHeaderView in the SfScheduler.

    this.Scheduler.HeaderView.TextFormat = "MMM yy";
    See Also
    Height
    Background

    TextStyle

    Gets or sets the style of header text, that used to customize the text color, font, font size, font family and font attributes.

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

    It will be applicable to all View.

    Examples

    The below examples shows, how to use the TextStyle of the SchedulerHeaderView in the SfScheduler.

    var textStyle = new SchedulerTextStyle()
    {
       TextColor = Colors.Red,
       FontSize = 12,
    };
    this.Scheduler.HeaderView.TextStyle = textStyle;
    See Also
    Height
    Background
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved