开发者

WPF Datepicker - Bolded Dates

开发者 https://www.devze.com 2023-02-13 05:53 出处:网络
Is there any way to set a series of dates that will be displayed within the DatePicker as bold (or otherwise highlighted)?

Is there any way to set a series of dates that will be displayed within the DatePicker as bold (or otherwise highlighted)?

=UPDATE= Apologies, seems I have not explained myself sufficiently. I am looking to get outlook-similar behaviour with the calendar popup on the WPF DatePicker. An example is as follows;

WPF Datepicker - Bolded Dates

All dates are still selectable and the bolded dates are shown irrespective of any current selection. The purpose of these bolded dates are to aid the user in sele开发者_如何转开发cting a date and or to represent items of interest.


Will crossing out work? if so, you could use BlackoutDates (you can have multiple CalendarDateRange )

<DatePicker.BlackoutDates>
    <CalendarDateRange Start="2/1/2011" End="2/10/2011"/>
</ DatePicker.BlackoutDates>

or from code

calendar1.BlackoutDates.Add(new CalendarDateRange(
        new DateTime(2011, 2, 1),
        new DateTime(2010, 2, 10)
        ));


You can select multiple dates like this

<DatePicker Name="MonthlyCalendar"    
    SelectionMode="MultipleRange"     
    DisplayDate="3/5/2010"    
    DisplayDateStart="3/1/2010"    
    DisplayDateEnd="3/31/2010"    
    FirstDayOfWeek="Tuesday"    
    IsTodayHighlighted="True"    
    xmlns:sys="clr-namespace:System;assembly=mscorlib" Margin="15,39,88,19">
    <DatePicker.SelectedDates>    
        <sys:DateTime>3/5/2010</sys:DateTime>    
        <sys:DateTime>3/15/2010</sys:DateTime>    
        <sys:DateTime>3/25/2010</sys:DateTime>    
     </DatePicker.SelectedDates> 
</DatePicker>

For more info check these links

http://www.c-sharpcorner.com/UploadFile/mahesh/563/

http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-calendar-datepicker-walkthrough.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消