Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
Disable dates using CalendarDateRange
posted

Hi

I need some help here to write some XAML code, sorry for my ignorance.

I was able to disable Saturday and Sunday for XamDateTimeEditor control with the style property.

<igEditors:XamDateTimeEditor>
  <igEditors:XamDateTimeEditor.Resources>
    <Style TargetType="{x:Type igEditors:XamMonthCalendar}">
      <Setter Property="DisabledDaysOfWeek" Value="Saturday, Sunday" />
    </Style>
  </igEditors:XamDateTimeEditor.Resources>
</igEditors:XamDateTimeEditor>

 I am trying achieve similar line with the below code, setting the business rule driven Min and Max date for XamDateTimeEditor control using CalenderDateRange, I am getting error "The Property Setter 'DisabledDates' cannot be set because it does not have an accessible set accessor"

<igEditors:XamDateTimeEditor>
  <igEditors:XamDateTimeEditor.Resources>
    <Style TargetType="{x:Type igEditors:XamMonthCalendar}">
      <Setter Property="DisabledDates"  >
 <Setter.Value>
   <igEditors:XamMonthCalendar.DisabledDates>
     <igEditors:CalendarDateRange Start="01/01/1000" End="04/01/2010" />
          <igEditors:CalendarDateRange Start="04/27/2010" End="12/31/4712" />
   </igEditors:XamMonthCalendar.DisabledDates>
 </Setter.Value>
      </Setter>
    </Style>
  </igEditors:XamDateTimeEditor.Resources>
</igEditors:XamDateTimeEditor>

I believe I got the syntax wrong here, I need some guidence what is the best way to have the dates appear disabled inte calender control comes as part of XamDateTimeEditor. I under stand, I still need to validate for the dates when use key in those dates outside the range specified above.