I have a list of dates.
I would like to be able to populate a windows forms monthcalendar control to show these dates as selectable(clickable) dates, whilst any date that is not in the list is disabled on the calendar control.
Is it possible to do this?
regards,
You can set the MinDate and MaxDate properties in order to give the user a specific range of dates to choose from. I don't believe removing dates between MinDate and MaxDate is a function the current control supports. You'd have to implement your own custom MonthCalendar control for that.
Related
I want to make my DatePicker allow you to select a start and end date to create a range. Much like when you use dates on airline sites... It has you pick a start and an end in one popup of the DatePicker.
The only examples I see for ranges are 2x DatePicker and they use one as start and the other as end.
Has anyone done this or know what properties to enable to get it to behave this way?
You can use Calendar Control instead, it allows you select multiple dates hence giving you a range of dates. All you will have to do is to change it's style to make it look like a DatePicker Control.
Here is a link for Customizing the Calendar Control:
https://msdn.microsoft.com/en-us/magazine/dd882520.aspx
Another one:
http://classpattern.com/wpf-popup-calendar.html#.V700jU197IU
I'm wonder can we set dates highlighted on datetimepicker before shows calendar. something like this. i know month calendar BoldedDates does the job but is it possible to do same thing with datetimepicker
I don't think that is possible using the existing Datapicker control.You might have to create a new custom DateTimePicker control.
Take a look http://www.techpowerup.com/forums/threads/a-custom-datetimepicker-control-in-c.70925/
Currently i developing a WPF application. My application allow user to select any date from the datepicker and data from the selected date will show up. However, user is not allow to select any specific time from the datepicker. The output from the datepicker will be something like 02-dec-2012 12:00:00 AM. The time from the datepicker will always be 12:00am. So, how can i allow user to alter the time?
I found some resource from DateTimePicker, but i looking for another solution. Any advice? Thanks
WPF DatePicker doesn't support time selection or display. It only supports Date picking.
A simple workaround is to use several TextBox controls and bind their Text property to a DateTime data source to allow the user to see and change the time.
For more information about DataBinding, please refer to http://msdn.microsoft.com/en-us/library/ms752347.aspx.
If you want to add time picking feature to DatePicker, you will need to introduce custom control.
For more information about Custom Control, please refer to http://msdn.microsoft.com/en-us/library/ms745025.aspx.
Source
you can also take a look at the following example for how to do this: Example Project
Is it possible to limit which dates a user can select from a dateTimePicker on a C# winforms application?
The basic principle for me is this: I have a comboBox with 5 items in it, based on which item the user selects I would like to limit which dates the user can then select from, having the unavailable dates grayed out.
Is this possible?
Use the MinDate and MaxDate properties.
dateTimePicker.MinDate = DateTime.Now;
dateTimePicker.MaxDate = DateTime.Now.AddDays(15);
(render on a french Windows 7)
You can set a minimum and a maximum date for the C# WinForms DTP, so if thats what you wish to do, then you can use the MinValue and MaxValue variables. You can't pick and choose blocks of dates that are not allowed. This is something you would have to add yourself. There are 2 possible methods of doing this:
Handing the ValueChanged event, then validate the date chosen.
Inherit the DTP class and add some extra functionality in there.
The DateTimePicker control has MaxDate and MinDate properties. Set those, and you can control the range of dates that can be selected. Currently on my Windows XP with Windows Classic theme the unselectable dates do not appear grayed, but this may vary depending on operating system, theme, etc. If you absolutely must gray them, then you will have to subclass the DateTimePicker control and do the (or part of the) painting yourself.
Yes, at least MSDN says so. Refer here.
You can set up the date restrictions in the following manner
dateTimePicker1.MinDate = DateTime.Today.AddDays(-2);
dateTimePicker1.MaxDate = DateTime.Today.AddDays(2);
In these case only the 5 available dates would be selectable for the user and the rest is not available. You could set up these values in the selectedindex changed event for the combobox and restrict it on the basis of your requirement/logic.
I want to use date time picker for my window application. I am using Min Date Max Date property in my code. But user interface for inputing date is very complex for the purpose of accounting where we need faster typing speed and no or very less use of mouse.
I want to modify a user interface for date time picker such that user need to type 24012010 for 24/01/2010.
What i need to do for this. Or is it their any dll or some other tool which can provide me all the functionalities of date time picker with this functionality
Use a MaskedTextBox. There's a good example on that page which will make sure the user has only entered numbers for their date. You'll then have to make sure the numbers form a valid date (i.e. not 99/99/9999) with your own validation code.
You can use third party controls for such a thing - we have been using DevExpress controls for about 4 years and are pretty happy :-).