Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Blackout dates not visible #1311

Open
APerricone opened this issue Jan 10, 2025 · 2 comments
Open

Blackout dates not visible #1311

APerricone opened this issue Jan 10, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@APerricone
Copy link

APerricone commented Jan 10, 2025

Is your feature request related to a problem? Please describe

Without wpfui i used DatePicker's BlackoutDates but on this version they are not showed.

Describe the solution you'd like

I would like they are grayed and strikethrough.

Describe alternatives you've considered

I can use default style for datepicker

Additional context

No response

@APerricone APerricone added the enhancement New feature or request label Jan 10, 2025
@APerricone APerricone changed the title Feature request title Blackout dates not visible Jan 11, 2025
@APerricone
Copy link
Author

Hi, I made an example, here how it is show with old style and with WPF-UI style:
image
here the code to reproduce the issue:

         DateTime min = DateTime.Now;
         DateTime max = min.AddMonths(1);
         cal1.DisplayDateStart = cal2.DisplayDateStart = min;
         cal1.DisplayDateEnd = cal2.DisplayDateEnd = max;
         DateTime d = min;
         while(d <= max) {
            switch(d.DayOfWeek) {
               case DayOfWeek.Wednesday:
               case DayOfWeek.Saturday:
               case DayOfWeek.Sunday:
                  cal1.BlackoutDates.Add( new CalendarDateRange( d ) );
                  cal2.BlackoutDates.Add( new CalendarDateRange( d ) );
                  break;
            }
            d = d.AddDays( 1 );
         }

I can fix it on xaml probably but I don't know how to do it...
Thanks
Perry

@APerricone
Copy link
Author

I was able to do it by xaml:

      <DatePicker x:Name="picker">
         <DatePicker.CalendarStyle>
            <Style TargetType="Calendar" BasedOn="{StaticResource DefaultCalendarStyle}">
               <Setter Property="CalendarDayButtonStyle">
                  <Setter.Value>
                     <Style TargetType="CalendarDayButton" BasedOn="{StaticResource DefaultCalendarDayButtonStyle}">
                        <Style.Triggers>
                           <Trigger Property="IsBlackedOut" Value="True">
                              <Setter Property="Opacity" Value="0.25"/>
                           </Trigger>
                        </Style.Triggers>
                     </Style>
                  </Setter.Value>
               </Setter>
            </Style>
         </DatePicker.CalendarStyle>
      </DatePicker>

but it set the opacity to calendar drop down too 😟

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant