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

how to display subject in monthview?

I followed sample application and achieved successfully but when I am in month view, i see only the colors over the dates. 
1)it is possible to display subject text?
 2) even further can I display icons? 
3) I am not sure if that is something to do with count of each days. displayed. because currently 42 days are displayed on a month when switch to month view. Can I reduce these?

thank your very much for your support,

Emil 

9 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team November 9, 2016 09:22 AM UTC

Hi Emil,

Thank you for interest in Syncfusion products.

Query 1:
Based on the provided information, we suspect that your requirement is to display ScheduleAppointment in the MonthView in Xamarin Forms. As per the implementation Appointments Subject will not be visible in MonthView, and you can Customize the MonthCell by MonthCellStyle and MonthCellLoaded event. So that you can customize as per your requirement in MonthView.

Query 2:
Yes, by setting View as Image in the MonthCellLoaded event you can display icon in the MonthCell. Please find the below code,
 
  
void Schedule_OnMonthCellLoadedEvent(object sender, MonthCellLoadedEventArgs args)
{
Button button = new Button();
button.Image = "user.png";
args.view = button;
}
 
 

Query 3:
As per the implementation, Month visible dates (42) contains certain dates from previous and next month will also loaded to complete the first and last weeks. In order to achieve your requirement you can hide the Previous and Next month dates by setting White color as CellStyle TextColor in the Previous and NextMonth. Please find the below code example,
 
 
if (args.isPreviousMonthDate)
{
args.cellStyle.TextColor = Color.White;
}
else if (args.isNextMonthDate)
{
args.cellStyle.TextColor = Color.White;
}

 

We have also prepared the sample based on your requirement, please find the sample by the below link,

Sample link: ScheduleMonthviewCustomizationSample 

If the given solution doesn’t meet your requirement please revert to us by modifying the provided sample along with replication procedure, so that we could analyze on it and provide you a possible solution.

Regards,
Subburaj Pandian V
 



EM Emil March 12, 2017 01:31 AM UTC

HI,

Regarding Query 2, Schedule_OnMonthCellLoadedEvent is basically called for each available Month cell on the screen, therefore your solution will display icon in each and every month cell, is it possible to display it only for month cell which have appointment

thanks,

Emil


SP Sivakumar Punniya Moorthi Syncfusion Team March 13, 2017 07:09 AM UTC

Hi Emil,

Thanks for the update.


Based on your provided information, your requirement of “Setting the custom view only in the schedule appointment month cell in Xamarin.Forms” can be achieved by setting condition in theMonthCellLoadedevent.


Please refer the below code example:


[c#]

voidSchedule_OnMonthCellLoadedEvent(objectsender,MonthCellLoadedEventArgsargs)
{
if(args.appointments!=null)
{
//PassingtheCustomview
Buttonbutton=newButton();
button.Image="user.png";
args.view=button;
}
}

If the provided solution does not meet your requirement, please revert us back with your queries.


We are happy to assist you.


Regards,

Sivakumar P



EM Emil March 23, 2017 02:04 AM UTC

Hi Sivakumar,

thanks for your suggestion but i have some problems here. Using the way you suggested doesnt work well because I am loosing day numbers in the monthcells. So my requirement is to display an image and keep day numbers as well. For that I tried to use a label and image within a stacklayout as shown below. It works ok indeed but I have a few problems.

1- ) I am losing separator lines between days. 
2- ) Although I tried to use VerticalOptions= LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand  Stacklayout wont fill the monthcell. thats why for the isPreviousMonthDate, I am not able to fill the background color correctly. 

please let me know what I am doing wrong or how can I achieve this.

thanks,

Emil

   void Schedule_OnMonthCellLoadedEvent(object sender, MonthCellLoadedEventArgs args)
        {
            var monthCell = new StackLayout { BackgroundColor = Color.Transparent, VerticalOptions= LayoutOptions.FillAndExpand, HorizontalOptions =                                   LayoutOptions.FillAndExpand };
            if (args.isPreviousMonthDate)
            {
                monthCell.BackgroundColor = Color.Silver;
            }
            else if (args.isNextMonthDate)
            {
                monthCell.BackgroundColor = Color.Transparent;
            }
            Label lbl = new Label()
            {
                Margin = new Thickness(4, 4),
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Text = args.date.Day.ToString(),
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start
            };
            monthCell.Children.Add(lbl);
            if (args.appointments != null && (args.appointments as ScheduleAppointmentCollection).Count > 0)
            {
               
                Image img = new Image()
                {
                    Source = ImageSource.FromFile("thumb.png"),
                    //Aspect = Aspect.AspectFit,
                    WidthRequest = 36,
                    HeightRequest = 36,
                  
                    VerticalOptions = LayoutOptions.End,
                    HorizontalOptions = LayoutOptions.Center
                };
             
                monthCell.Children.Add(img);             

                // *** For previous & next monthCellText customization
            }
            args.view = monthCell;
        }


SP Subburaj Pandian Veluchamy Syncfusion Team March 23, 2017 07:11 AM UTC

Hi Emil, 
 
Thank you for the update. 
 
Based on the provided information, we have checked your query with Setting CustomView to the Schedule MonthCell along with the default Schedule dates in Xamarin Forms. It can be achieved by setting Schedule MonthCellViewLayout property as Overlay and setting the ParentLayout (Grid, Stack) backgroundColor as Transparent. Please refer the below code example, 
 
[c#] 
schedule.MonthCellViewLayout = ViewLayoutOptions.Overlay; 
 
 
You can set the parent layout options (Center/Fill) as per your required positions, we have prepared simple sample based on your requirement. Please find the below sample, 
 
 
In the sample, we have Set StackLayout as a parent layout and added two labels as the CustomView child with Overlay option in the Schedule. And the Layout option as center to display the CustomView as Center in the MonthCell, you can set change the child (label) Height and Width as per your requirement. 
 
If the given solution doesn’t meet your requirement, could you please revert to us by modifying the provided sample based on your requirement with the screenshot (if possible) of your requirement, it will be helpful for us to check on it and provide you the better solution.  
  
Regards,  
Subburaj Pandian V.    



EM Emil March 23, 2017 08:34 AM UTC

Hi Subburaj,

This solves my problem with the lines but I am getting back the dark blue lines. Reason I use an image is to replace those lines with the image. Now I have bot of them. Is it possible to get rid of these blue default lines?

thanks,

Emil 


SP Subburaj Pandian Veluchamy Syncfusion Team March 24, 2017 07:15 AM UTC

Hi Emil, 
 
Thank you for the update, we are happy that the given solution has resolved your issue with the provided solution. 
 
New Query:  
Are you mentioning about ScheduleAppointment notation in MonthView, since your requirement is about to set CustomView in MonthCell along with the default MonthCell. So, that default dates and Appointments will be visible while setting CustomView as Overlay. By positioning the CustomView (Image) using LayoutOptions you can achieve your requirement of setting over the Appointment notation (Blue line) in the MonthCell.  
 
If you face any issues, could you please modify the provided sample based on your requirement we will check on it and provide you the better solution. 
 
Regards,  
Subburaj Pandian V.    



RO roberto April 7, 2017 01:50 PM UTC


Good morning,
is there any way to put the number of appointments in the monthview,
thanks for your help



SP Subburaj Pandian Veluchamy Syncfusion Team April 10, 2017 11:13 AM UTC

Hi Roberto, 
 
Thank you for your interest in Syncfusion products. 
 
Based on the provided information, we have checked and your requirement of setting the Appointments count in the Month cell can be achieved by using appointments argument in the OnMonthCellLoadedEvent in Schedule Xamarin Forms. Please refer the below code example, 
 
[c#] 
void Schedule_OnMonthCellLoadedEvent(object sender, MonthCellLoadedEventArgs args)
        {
            var count = ((ScheduleAppointmentCollection)args.appointments).Count;
        } 
 
 
By using this event you can customize the Month cell by setting the CustomView (Button, Label, etc..) in the View argument. To know more about Month customization, please refer our online user guide documentation by the following link, 
 
 
If the given solution doesn’t meet your requirement, could you please revert to us with more information about your query with screenshot (if possible), it will be helpful for us to check on it and provide you the better solution.  
 
Regards,  
Subburaj Pandian V.    


Loader.
Up arrow icon