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
close icon

Add more ranges for BlackoutDatesRange

Hello, I am trying to add more ranges in CalendarEdit for BlackoutDates like this:

<syncfusion:CalendarEdit Grid.Column="0" Grid.Row="0" 
                                         x:Name="calendarEdit" 
                                         VerticalAlignment="Center"
                                         HorizontalAlignment="Center"
                                         Width="350"
                                         Height="300">                   
                    <syncfusion:CalendarEdit.BlackoutDates>                                 
                            <syncfusion:BlackoutDatesRange StartDate="1/01/1900" 
                                                       EndDate="{x:Static sys:DateTime.Today}"/>

                            <syncfusion:BlackoutDatesRange StartDate="1/20/2019" 
                                                       EndDate="2/13/2020"/>
                    </syncfusion:CalendarEdit.BlackoutDates>
</syncfusion:CalendarEdit>


But it is not working, it is getting me error

Looks like it is not possible :(


Can you help me?

3 Replies

AA Arulraj A Syncfusion Team January 11, 2019 08:38 AM UTC

Hi Luis 
 
Thanks for using Syncfusion product. 
 
We have checked your query “How to Add more ranges for BlackoutDatesRange in CalendarEdit”. We have prepared a sample based on your requirement in which we have added more ranges for BlackoutDatesRange in CalendarEdit as like you did, but we did not face any error. And also please ensure whether you have added System namespace reference in your xaml code. Please find the code snippet, sample and video for the same from the following location. 
 
<Window 
        xmlns:local="clr-namespace:WpfApp1" 
        xmlns:syncfusion="http://schemas.syncfusion.com/wpf"   x:Class="WpfApp1.MainWindow" 
        mc:Ignorable="d"  
        xmlns:system="clr-namespace:System;assembly=mscorlib" 
        Title="MainWindow" Height="450" Width="800"> 
    <Grid>                                
        <syncfusion:CalendarEdit Grid.Column="0" Grid.Row="0"  
                                         x:Name="calendarEdit"  
                                         VerticalAlignment="Center" 
                                         HorizontalAlignment="Center" 
                                         Width="350" 
                                        Height="300"> 
            <syncfusion:CalendarEdit.BlackoutDates> 
                <syncfusion:BlackoutDatesRange StartDate="1/01/1900" EndDate="{x:Static system:DateTime.Today}"/> 
 
                <syncfusion:BlackoutDatesRange StartDate="1/20/2019" EndDate="2/13/2020"/> 
            </syncfusion:CalendarEdit.BlackoutDates> 
        </syncfusion:CalendarEdit> 
    </Grid> 
</Window> 
 
 

 
 
Please try the above solution and let us know if it is helpful.  
 
Regards, 
Arulraj A 



LA Luis Angel Valencia January 11, 2019 01:55 PM UTC

Well this worked this morning, that was weird...

anyway, thank you very much...

another question 


<syncfusion:BlackoutDatesRange StartDate="1/21/2019" 
                                                       EndDate="2/13/2100"/>

How can i make the calendar to have endless range with blackoutdatesrange?, i dont want to put EndDate="2/13/2100"


Thankssss



JP Jagadeesan Pichaimuthu Syncfusion Team January 14, 2019 08:12 AM UTC

Hi Luis,   
  
Thanks for using Syncfusion product.  
 
Currently our CalendarEdit control doesn't have support to select range of dates without using end date property of blackoutdates. If we set maximum date as end date of blackoutdates, we can select the range of dates till the maximum date. 
 
Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon