C#/WPF 프로젝트에 캘린더가 필요합니다. 우리는 약속 스케줄링을 위해 일정 범위의 날짜를 선택하기 위해이를 사용할 것입니다. 기본 캘린더가 일부 담당자에게 사용하기에는 너무 작아서 크기 조정 작업을하고 있다고 들었습니다.내 스타일의 제어 템플릿이 내 캘린더의 사용 제한 시간을 초과합니다.
<toolkit:Calendar Grid.Row="1" x:Name="DateWindowCalendar"
BorderBrush="White" BorderThickness="0"
Style="{StaticResource PopupCalendarStyle}"
DisplayMode="Month" SelectionMode="SingleRange"
DisplayDateStart="{Binding FirstDayOfMonth}"
AutomationProperties.AutomationId="ToolkitCalendarId"
VerticalAlignment="Top">
</toolkit:Calendar>
은 내가이 스타일을 만들었습니다
<Style x:Key="PopupCalendarStyle" TargetType="toolkit:Calendar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="toolkit:Calendar">
<StackPanel Margin="0" HorizontalAlignment="Center" x:Name="Root">
<toolkit:Calendar x:Name="Calendar"
SelectedDate="{TemplateBinding SelectedDate}"
DisplayDateStart="{TemplateBinding DisplayDateStart}"
SelectionMode="{TemplateBinding SelectionMode}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SelectedDatesChanged="Calendar_SelectedDatesChanged">
<toolkit:Calendar.CalendarDayButtonStyle>
<Style>
<Setter Property="Button.Height" Value="34"/>
<Setter Property="Button.Width" Value="34" />
<Setter Property="Button.FontSize" Value="16" />
</Style>
</toolkit:Calendar.CalendarDayButtonStyle>
<toolkit:Calendar.CalendarButtonStyle>
<Style>
<Setter Property="Button.Height" Value="34"/>
<Setter Property="Button.Width" Value="34"/>
<Setter Property="Button.FontSize" Value="16"/>
</Style>
</toolkit:Calendar.CalendarButtonStyle>
</toolkit:Calendar>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
모든 것이 거의 완벽합니다. 내 범위를 지정하면 선택한 날짜를 추적 할 수 있습니다 (SelectedDates 속성 대신 SelectedDatesChanged 이벤트를 사용하여 부여됨).
문제는 또한 정전 날짜를 설정할 수 있어야합니다. .
DateWindowCalendar.BlackoutDates.Add(new CalendarDateRange(
new DateTime(DateTime.Now.Year, DateTime.Now.Month, 01), DateTime.Now));
을하지만 스타일을 추가 할 때, 나는있는 표시를 검은 색을 얻을하지 않습니다 : 오늘 때로는 먼저 지금부터 몇 일 월)
의 스타일없이,이 작동하지만, 표시되며 더 이상 블랙 아웃 날짜를 선택할 수 없습니다.
내가 무엇을 놓쳤는 지 잘 모르겠지만 누군가가 쉬운 대답을하기를 바라고 전체 위젯을 다시 만들 필요가 없다.
도움을 주시면 감사하겠습니다.
감사합니다,
크리스 당신이 존중되는 곳 내가 볼 수없는 당신의 스타일에