Hi
I'm looking to create a custom filter control to use on a popup container control. Essentially I want two calendars side by side where a user can select a start and end date, one from each calendar. I also want them to have the ability to select the start year without having to scroll through years of dates to find the date in a particular year. The standard windows forms date time picker has this functionality but I haven't found an infragistics calendar control with this functionality (so if you click on the month in the heading it drills to the months with the year on top then you can drill through the years) . I've tried the UltraMonthViewSingle control that comes close as it doesn't require drop down but cant see a way of displaying the year and drilling through them.
Any advice would be appreciated.
Cheers
Dave
Hello Dave,
I would like to suggest using UltraDateTimeEditor, which is based on MS MonthCalendar. However, there is only one calendar in the dropdown of the component, so you can use two of them, and bind the startDate and endDate and make sure the startDate is before the endDate.
The other option which I can offer is using ultraTextEditor and modifying the DropDownEditorButton to contain two calendars. You can use a panel to hold them so it will look like this:
this.tableLayoutPanel1.Controls.Add(this.monthCalendar1); this.tableLayoutPanel1.Controls.Add(this.monthCalendar2); DropDownEditorButton editorButton = new DropDownEditorButton(); editorButton.Control = this.tableLayoutPanel1; this.ultraTextEditor1.ButtonsRight.Add(editorButton);
In this case it would be best if you do not allow the user to be able to write in the editor and have him select dates from the calendars.
Please let me know if you need help implementing any of the ideas above, and I will be happy to assist you.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
The second approach, with two MonthCalendars on a DropDown seems like it would be very neat.
But there would be a lot of coding involved, I think.
You might want to put in some labels to make it clearer what the calendars are for. Also, there's the question of whether you want the user to be allowed to type into the combo. And if so, you would need some kind of parsing logic to turn the user-entered string into a range of dates. Presumably using some kind of custom format like using a dash to separate the dates. You would want to handle the dropping down of the button so you can synchronize the calendars with the current date range. And then there is error-handling for when the parsing fails. It would be interesting to make this work, though. :)
This seems like a fun and interesting challenge, so I went ahead and created a sample prototype. To keep it simple, I don't allow the user to type into the control. There is more to do here, I expect, but I think it works pretty well as is.
DateRange.zip
Hi Mike
Thanks for the demo and taking time to look into this.
I've actually managed to create something that seems to be exactly what you suggested. I created a custom control with two month calendars and added the control to the popup container control. I also keep the date ranges in sync between the two month calendars as you have done by only showing the range of dates after the start date selected. If the user selects another start date then the start date range refills. If the user changes end date then the start date range changes to a max date of the end date selected.
Spooky how both solutions are so similar :)
Would be cool if at some point infragistics adds this type of calendar control (month calendar with no drop down). to their arsenal so can be as fully featured as the existing infragistics controls.