Stafford Williams
Stafford Williams

Reputation: 9806

WPF Datepicker - Bolded Dates

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; calendar example

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 selecting a date and or to represent items of interest.

Upvotes: 2

Views: 1755

Answers (2)

biju
biju

Reputation: 18000

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

Upvotes: 0

Bala R
Bala R

Reputation: 108937

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)
        ));

Upvotes: 1

Related Questions