We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Additional Controls

I have copied your example calendar installation to my solution. 

I am interested in adding some label and button controls to the "MainPage" either on top of or below the SfCalendar. 
------------------------------------------------------------------------------------------------------------------------------------
XAML

       
           
               
                        CurrentMonthBackgroundColor="#ffffff"
                        CurrentMonthTextColor="#000000"
                        PreviousMonthBackgroundColor="#f2f2f2"
                        PreviousMonthTextColor="#000000"
                        DateSelectionColor="Aqua"
                        SelectedDayTextColor="#000000"
                        BorderColor="Aqua"
                        DayHeaderBackgroundColor="#000000"
                        DayHeaderTextColor="Aqua" 
                        CellGridOptions="Both"
                        TodayTextColor="Aqua" 
                        DayLabelTextAlignment="Center"
                        DateTextAlignment="Center" >
                   
                       
                            DateFormat="dd"
                            DayFormat="EEE"
                            DayLabelSize="22"
                            DateLabelSize="14" />
                   
                   
           
       
   
---------------------------------------------------------------------------------------------------------------------------------------
C#

public MainPage()
{
            InitializeComponent();

            SfCalendar calendar = new SfCalendar();

            MonthLabelSettings labelSettings = new MonthLabelSettings();
            labelSettings.DateFormat = "dd";
            labelSettings.DayLabelSize = 20;
            labelSettings.DayFormat = "EEE";
            labelSettings.DateLabelSize = 12;

            MonthViewSettings monthViewSettings = new MonthViewSettings();
            monthViewSettings.CurrentMonthBackgroundColor = Color.FromHex("#ffffff");
            monthViewSettings.CurrentMonthTextColor = Color.FromHex("#000000");
            monthViewSettings.PreviousMonthBackgroundColor = Color.FromHex("#f2f2f2");
            monthViewSettings.PreviousMonthTextColor = Color.FromHex("#000000");
            monthViewSettings.DateSelectionColor = Color.Aqua;
            monthViewSettings.SelectedDayTextColor = Color.FromHex("#000000");
            monthViewSettings.BorderColor = Color.Aqua;
            monthViewSettings.DayHeaderBackgroundColor = Color.FromHex("#000000");
            monthViewSettings.DayHeaderTextColor = Color.Aqua;
            monthViewSettings.CellGridOptions = CellGridOptions.Both;
            monthViewSettings.DayLabelTextAlignment = DayLabelTextAlignment.Center;
            monthViewSettings.DateTextAlignment = DateTextAlignment.Center;
            monthViewSettings.TodayTextColor = Color.Aqua;
            
            monthViewSettings.MonthLabelSettings = labelSettings;
            calendar.MonthViewSettings = monthViewSettings;

            this.Content = calendar;
}
--------------------------------------------------------------------------------------------------------------------------------------

When I attempt to throw in a Button control or Label control it either doesn't show up or it says "The Property 'Content' is set more than once."

I am new to this. Any advice? Also where would I put the controls in XAML and C#? Thanks in advance. Appreciate any help I can get.

1 Reply

SP Subburaj Pandian Veluchamy Syncfusion Team February 27, 2019 12:42 PM UTC

Hi Frank, 
 
Thank you for contacting Syncfusion support. 
 
Based on the provided information, we have checked your query about “How to add button or other control along with calendar” and you can achieve this by placing calendar and button an any of the layout on the default content page. We suspect that you have set both the elements in the same, so that issue may occurs. Hence you need to place a layout and arrange the required controls inside the layout based on your requirement. 
 
We have prepared sample for the same, please find the sample by the following link. 
 
Sample link: Calendar. 
 
We hope that this helps you. If this sample doesn’t meet your requirement, kindly revert with more details, which helps us to analyze and resolve your requirement. 
 
Regards,
Subburaj Pandian V  


Loader.
Live Chat Icon For mobile
Up arrow icon