Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I don't believe this really answered the OP question.

                                    https://www.devexpress.com/Support/Center/Question/Details/Q354931 

                                    In that question he wanted to know how to have the Calendars display Prev and Next month only, not just the current month.

                                    In my attached picture you see I am displaying the Month View of October 2016, I have placed 2 CalendarControls either side of the TItle, what I want is to set the month of the left CalendarControl as the prev month and the right as the next month.

                                    N ormally in XtraReports you would have a Scripts property and could set the BeforePrint script, and I would assume you would adjust the dates there? Do we do that on the BeforePrint of the DetailBand?

                                    The issue is I can't seem to find any relavent members that would allow allow me to advance the CalendarControl interval.   https://documentation.devexpress.com/#WindowsForms/DevExpressXtraSchedulerReportingCalendarControlMembersTopicAll

                                    Some help on this would be great. Cheers.
                                Show all comments
                                • OK, so after alot of source code hunting... the only way I could find to do this was to override the CalendarControl.

                                  Simple enough, however.... you have a method signature that isn't very friendly.

                                  The issue with my interim fix is that it won't support CustomDrawDayNumberCell (as in your method that is set to the DateNavigator which is internal, and the BoldAppointmentDates also doesn't work as that is internal.

                                  Your CalculatePrintInfoCore(ControlLayoutInfo info) method seems to be the best place to intercept the creation of the new CalendarPrintInfo.

                                  However the issue is it passes the this.TimeCells as the ISupportPrintableTimeInterval which is a pain to try and intercept.

                                  Ideally, you guys have a ReadOnly PrintTimeInterval property (which is not browsable but Public) but no way to intercept the desired interval (and it isn't used).

                                  Looking at the code I think that was the intention because there is a BeforeCalculatePrintInfo() override which is setting the PrintTimeInterval... but then it isn't used in the actual CalculatePrintInfo....

                                  So again in summary my suggestion is:
                                  * Mark GetPrintTimeInterval as Virtual
                                  * Use PrintTimeInterval in your CalculatePrintInfoCore method when initialising the CalendarPrintInfo)

                                  Unless of course I have found the most complex way of achieving something that is actually easy to do and I just missed it :D

                                  [C#]
                                  public class AlfCalendarControl : DevExpress.XtraScheduler.Reporting.CalendarControl { public AlfCalendarControl() : base() { } public AlfCalendarControl(DevExpress.XtraScheduler.Reporting.ReportViewBase view) : base(view) { } private int monthAdjustment; public int MonthAdjustmnet { get { return monthAdjustment; } set { monthAdjustment = value; } } protected override CalendarPrintInfo CalculatePrintInfoCore(ControlLayoutInfo info) { if (DesignMode) return base.CalculatePrintInfoCore(info); var newResult = new CalendarPrintInfo(this, this.SchedulerReport.SchedulerAdapter, new AlfCustomPrintableTimeInterval(TimeCells, MonthAdjustmnet), info.ControlPrintBounds); return newResult; } } public class AlfCustomPrintableTimeInterval : ISupportPrintableTimeInterval { private int monthAdjustment; private TimeCellsControlBase timeCells; public AlfCustomPrintableTimeInterval(TimeCellsControlBase TimeCells, int MonthAdjustment) { timeCells = TimeCells; monthAdjustment = MonthAdjustment; } public TimeInterval GetPrintTimeInterval(PrintContentMode displayMode) { var result = ((ISupportPrintableTimeInterval)timeCells).GetPrintTimeInterval(PrintContentMode.CurrentColumn); result.Start = result.Start.AddMonths(monthAdjustment); result.End = new DateTime(result.Start.Year, result.Start.Month, DateTime.DaysInMonth(result.Start.Year, result.Start.Month), 23, 59, 59); return result; } }



                                • This is how it looks now.
                                • Slight adjustment to my suggestion. Thinking about the signature of the CalendarPrintInfo constructor, it is expecting a ISupportPrintableTimeInterval and the PrintTimeInterval is only a TimeInteval.

                                  Therefore, I think the easiest way would be to implement the ISupportPrintableTimeInterval to the CalendarControl itself.

                                  Then within the GetPrintTimeInterval method this could just be a protected virtual which can be overridden to customise the date displayed?

                                  (in my code I have to still override the CalculatePrintInfoCore and manually create the CalendarPrintInfo, however you get the idea.

                                  [C#]
                                  public class AlfCalendarControl : DevExpress.XtraScheduler.Reporting.CalendarControl, ISupportPrintableTimeInterval { public AlfCalendarControl() : base() { } public AlfCalendarControl(DevExpress.XtraScheduler.Reporting.ReportViewBase view) : base(view) { } private int monthAdjustment; public int MonthAdjustment { get { return monthAdjustment; } set { monthAdjustment = value; } } protected override CalendarPrintInfo CalculatePrintInfoCore(ControlLayoutInfo info) { if (DesignMode) return base.CalculatePrintInfoCore(info); var newResult = new CalendarPrintInfo(this, this.SchedulerReport.SchedulerAdapter, this, info.ControlPrintBounds); return newResult; } public TimeInterval GetPrintTimeInterval(PrintContentMode displayMode) { var result = ((ISupportPrintableTimeInterval)TimeCells).GetPrintTimeInterval(PrintContentMode.CurrentColumn); result.Start = result.Start.AddMonths(MonthAdjustment); result.End = new DateTime(result.Start.Year, result.Start.Month, DateTime.DaysInMonth(result.Start.Year, result.Start.Month), 23, 59, 59); return result; } }

                                • Mariya (DevExpress Support) 10.10.2016

                                  Hello Michael,
                                  Thank you for sharing your code with us. Your approach is absolutely correct and at the moment we cannot provide an alternative solution for this scenario. We agree that this approach is complicated and unobvious for end-users. So, it'll be useful to provide the capability to customize the printed interval for the CalendarControl from API. 
                                  We can implement the ISupportPrintableTimeInterval interval in our source code. However, the approach will not be flexible enough since it will still require creating a custom control. Perhaps, we could implement an event to customize the printed interval. What do you think about this solution? In this case, it will not be necessary to create the custom control.
                                  I look forward to your response.

                                • Fully agree that having to make a custom control is a bit much and there would be use cases. 

                                  I agree that a CustomPrintTimeInterval on the Calendar control that would pass the current PrintTimeInterval before creating the CalendarPrintInfo would be best.
                                • Mariya (DevExpress Support) 10.10.2016

                                  I've passed the suggestion to our developers. They'll consider the possibility to implement this event in the future version. I recommend you watch for our announcements to be notified when the required functionality is implemented.

                                  Please do not hesitate to contact us again if you face further difficulties or have any questions.

                                0 Solutions

                                Creation Date Rating Importance Sort by

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners