This is a migrated thread and some comments may be shown as answers.
How to just enable the dates in a list of DateTime
4 Answers 11 Views
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 12 Mar 2018, 01:28 AM

Hi,

I want to make all the dates disabled and just leaving some dates in a list of date enable. 

Can anyone tell me how to do that?

 

Thanks a lot!

4 Answers, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 1
answered on 12 Mar 2018, 01:31 AM
I am using Telerik UI for Xamarin
0
Accepted
Lance | Manager Technical Support
Telerik team
answered on 12 Mar 2018, 10:01 PM
Hello Tony,

I'm not sure exactly what you're asking for, from what I can tell you're asking to only have some of the appointment in the calendar selectable? You can make this determination in the AppointmentTapped event handler.

Have a property on your IAppointment implementation that states whether it's an "enabled appointment"

public class MyAppointment : IAppointment
    {
        public bool IsEnabled { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Title { get; set; }
        public Color Color { get; set; }
        public bool IsAllDay { get; set; }
        public string Detail { get; set; }
    }


Then in the AppointmentTapped event handler, don't do anything if IsEnabled is false

<input:RadCalendar AppointmentTapped="RadCalendar_OnAppointmentTapped"...>

private void RadCalendar_OnAppointmentTapped(object sender, AppointmentTappedEventArgs e)
{
    if (!(e.Appointment as MyAppointment).IsEnabled)
    {
        return;
    }
}

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tony
Top achievements
Rank 1
answered on 13 Mar 2018, 08:04 PM

Thank you so much Lance!  

I have another question, can I remove the circle of selected date? And can I change the background of some daycells real time?

Because I want to add a picker on that page, and if I select different doctor in the picker, the calendar can update and all the dates those the doctor is available, the background color of those daycells can be different and other day cells are disabled.

0
Lance | Manager Technical Support
Telerik team
answered on 13 Mar 2018, 09:26 PM
Hi Tony,

We're diverging from your original question. To prevent topic confusion and delays, I recommend that you open another thread for any new equations/issues you encounter.

To get the level of customization you're looking for you'll need to create custom renderers. Please review the control's documentation on styling, as well as the three custom renderer articles.



You'll have to keep in mind that these controls are native controls with Xamarin.Forms wrappers. As opposed to a Xamarin,Forms specific control (i.e. SkiaSharp based). To get custom functionality and interactions you'll want to learn how the native controls work and then build your custom renderer around that.

Here are the links to the native controls:

- UWP
- iOS
- Android

A final note about Xamarin.Forms Custom Renderers. Custom renderers falls outside the scope of Telerik Support, if you have any trouble creating renderers, I recommend reaching out on the Xamarin forums, StackOverflow and (if you use Slack) join the XamarinChart.slack.com group. 

You could also look into if using Xamarin Effects might be more useful for your scenario, learn more about Xamarin Effects here.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Tony
Top achievements
Rank 1
Answers by
Tony
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or