I am making a query to a database to get the first date and last date of data for a report. How do I block with a X like the default Silverlight calendar does on Telerik RadCalendar?
RadCalendar1.BlockedDates = value; <= Not available
Well I found a workaround. I expected if the date is outside the selectable range to be disabled (visually), not unclickable. I want to use to know just by viewing the calendar which dates are available (bold) and which ones are not grayed. It will be nice to have a BlockedDateRange as the default Silverlight calendar does. Don't know why (that is extremely useful).
public class CustomTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
CalendarButtonContent content = item as CalendarButtonContent;
if (content != null)
{
var calendar = container.GetVisualParent<RadCalendar>(); if(content.Date < calendar.SelectableDateStart || content.Date > calendar.SelectableDateEnd) {
content.IsEnabled = false; CalendarButton cb = container as CalendarButton;
cb.Opacity = 0.25; //Need a visual cue that the date is disabled.
I am glad that the issue you were facing is now resolved. Also, I would suggest you to use DisplayDateStart/End properties of the RadCalendar. This will disable all dates outside the range: