Skip to content

This repository contains a sample on How to customize the header view in the Syncfusion Xamarin.Forms Calendar (SfCalendar)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/customview-on-header-loaded-calendar-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to customize the header view of Calendar in Xamarin.Forms (SfCalendar) ?

You can change the header view by setting the content to CalendarHeaderEventArgs.View property in OnHeaderLoaded event.

C#

private void OnHeaderLoaded(object sender, CalendarHeaderEventArgs e)
{
    Grid grid = new Grid();
    grid.BackgroundColor = Color.FromHex("#E0CCFF");
    grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
    grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
    grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
    Image leftImage = new Image();
    leftImage.Source = "Left.png";
    Image rightImage = new Image();
    rightImage.Source = "Right.png";
    TapGestureRecognizer leftTap = new TapGestureRecognizer();
    TapGestureRecognizer rightTap = new TapGestureRecognizer();
    leftImage.GestureRecognizers.Add(leftTap);
    rightImage.GestureRecognizers.Add(rightTap);
    leftTap.Tapped += OnLeftHandleAction;
    rightTap.Tapped += OnRightHandleAction;
    Label label = new Label();
    label.SetBinding(Label.TextProperty, "SelectedMonth");
    label.FontSize = 18;
    label.HorizontalOptions = LayoutOptions.Center;
    label.VerticalOptions = LayoutOptions.Center;
    grid.Children.Add(leftImage, 0, 0);
    grid.Children.Add(label, 1, 0);
    grid.Children.Add(rightImage, 2, 0);
    e.View = grid;
}

Output

CustomHeaderView

About

This repository contains a sample on How to customize the header view in the Syncfusion Xamarin.Forms Calendar (SfCalendar)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages