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

Selected style for custom appointment template

Hi, I created custom AppointmentTemplate on Schedule for DayView.
How to set a SelectionBorder using AppointmentTemplate?

I try set a SelectStyle but this work only I selected an empty slot. For existing appointment not work.

<syncfusion:SfSchedule.SelectionStyle>
     <syncfusion:SelectionStyle 
               BackgroundColor="Gray" 
               BorderColor="Black"
               BorderThickness="2"
               BorderCornerRadius="5">
     </syncfusion:SelectionStyle>
</syncfusion:SfSchedule.SelectionStyle>
  

Thank you

Emanuel

5 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team July 9, 2019 10:54 AM UTC

Hi Emanuel, 
  
Thank you for contacting Syncfusion support. 
  
Based on the shared information, your requirement of “Applying SelectionBorder for AppointmentTemplate using Schedule SelectionStyle” is not possible. Since you are using AppointmentTemplate, selection style will not be applied to the appointment view. AppointmentTemplate is user defined, you are providing your own custom view for the appointment so if you want selection border you need to provide border color for your own view on appointment view selected. Schedule Style will apply only for the Schedule appointment and not in the custom UI. 
 
You can refer our User Guide documentation for the same, 
 
We hope this helps. Please let us know if you would require any further assistance. 
 
Regards,
Subburaj Pandian V     



EM Emanuel July 9, 2019 01:27 PM UTC

Hi Subburaj Pandian,
thank you for the feedback.

I had alreasy seen the link that you the link you gave me but I couldn't set the border for the selection using custom AppointmentTemplate.
I had seen the syncfusion examples for the schedule but I did not find similar examples with AppointmentTemplate.

Can you give me an example that does what I need?

Thanks

Regards,
Emanuel


SP Subburaj Pandian Veluchamy Syncfusion Team July 10, 2019 11:56 AM UTC

Hi Emanuel, 
  
Thank you for the update. 
  
AppointmentTemplate view is given by the user so whatever customization can be made on that view. We have prepared a sample to change selection style of AppointmentTemplate on appointment has been selected. On selecting an appointment existing selection should be cleared. 
 
Please refer the following code, 
  
[C#]  
private void Button_Clicked(object sender, EventArgs e) 
{ 
     var button = sender as Button; 
  
     //Storing selected appointment view to clear selection on next selection 
     if (!customViews.Contains(button)) 
         customViews.Add(button); 
  
      //Clears existing selected cell 
      schedule.SelectedDate = null; 
  
      //Clears existing selected appointment 
      this.ClearSelection(); 
  
      //Change Background color of selected appointment 
      var parentView = button.Parent as Grid; 
      if (parentView.BackgroundColor == Color.YellowGreen) 
          parentView.BackgroundColor = Color.Black; 
      else 
          parentView.BackgroundColor = Color.YellowGreen; 
} 
  
private void ClearSelection() 
{ 
      var previousSelectedView = customViews.FirstOrDefault(x => (x.Parent as Grid).BackgroundColor == Color.Black); 
      if(previousSelectedView != null) 
                (previousSelectedView.Parent as Grid).BackgroundColor = Color.YellowGreen; 
} 
  
Sample link: Schedule 
 
Note: In our sample we have used Button inside Grid as custom appointment view and handled style on button clicked event. 
  
We hope this helps. Kindly revert us if you have any concern. 
  
Regards,
Subburaj Pandian V
    



EM Emanuel July 10, 2019 03:33 PM UTC

Hi Subburaj Pandian,
Thank you for the example and for your support.

Regards,
Emanuel


SP Subburaj Pandian Veluchamy Syncfusion Team July 11, 2019 07:18 AM UTC

Hi Emanuel,  
   
Thank you for the update.  
 
Please let us know, if you would require any further assistance. As always, we will be happy to assist you. 
  
Regards,
Subburaj Pandian V  
 


Loader.
Live Chat Icon For mobile
Up arrow icon