Click here to Skip to main content
15,908,172 members

Comments by leptosomic (Top 2 by date)

leptosomic 4-Dec-12 18:51pm View    
And excuse me for not so clear formulation of question and broken language. This is my first post in english, I need more practice :)
leptosomic 4-Dec-12 18:42pm View    
I don't want to select all records from the table. I do GetDisplayRange at start and select dates between beginning and end of range. Indeed, why to select all records, if user can't see all of them in calendar at the moment? And what if there are too much records, how fast will it be? DateChanged doesn't fit, because it fires when user highlights dates, but user can scroll calendar without changing selected date. Assume, calendar displays september, october and november. A day selected in september, then user scrolls calendar to left, now we see august, september and october, and a day selected in september, date hasn't changed. And august haven't any bold dates, because it wasn't included in initial range, and program doesn't know, what it's time to select next portion of dates. Actually I need DisplayRangeChanged event.

May be I should use CalendarDimensions property and SelectionRange instead of GetDisplayRange.
something like this:
monthsDisplayed=CalendarDimensions.Width*CalendarDimensions.Height;
dateStart=SelectionRange.End.AddMonths(-monthsDisplayed);
dateEnd=SelectionRange.Start.AddMonths(monthsDisplayed);
and then select dates from datatable where dates between dateStart and dateEnd and on DateChanged recalculate this diapason and select next portion of data if diapason was increased. Just extending bounds of diapason in both sides such way that in worst case date will change early than user will see empty part of calendar.