Ticket T1285609
Visible to All Users

month view: select whole month when view changed manualy

created 7 days ago

Hello, when using the WPF DateNavigator integrated with the scheduler, the control automatically switches to month view when more than 7 days are selected. In this automatic mode, the view correctly shows only the selected days within the month. However, when the user manually selects the month view via the control’s interface, the selected days remain highlighted rather than the control resetting to display the entire month. Is there a way to change the behavior so that if a user manually selects the month view, the control  automatically clears any day selection in the datenavigator and displays the whole month?

Steps to Reproduce:

  1. Open the sample project: https://docs.devexpress.com/WPF/118066/controls-and-libraries/scheduler/examples/how-to-create-the-scheduler-with-the-datenavigator
  2. Select more than 7 days.
  3. Select a single day/week in the datenavigator or switch to day/workweek/week view.
  4. Manualy switch to month view. 
      -Observed behaviour: The selected days remain highlighted, and only those days are visible instead of the entire month.
      -Expected behaviour: On manual selection of month view, the entire month should be displayed, clearing the previously selected days.

Answers approved by DevExpress Support

created 6 days ago

Hello,
This behavior occurs because when DateNavigator is bound to SchedulerControl, it updates visible intervals according to the selected dates to display only the dates you selected in SchedulerControl. As a possible solution, you can handle the ActiveViewChanged event and reset MonthViews WeekCount to "5". I modified the example project to demonstrate the main idea. Please try this on your side and let us know your results.

Thanks,
Kirill

    Comments (2)

      However, this is not the desired behavior. The selection of the 5 weeks starts with the week of the smallest date of the current selection.
      The desired behavior is that by manually switching the view to month, the entire month of the smallest date is selected.

      e.g.

      • Currently selected day is 17.04.2025
        -> By changing to monthly view, the following range should be selected: 31.03.2025 - 04.05.2025

      • Currently selected days are: 29.04.2025 - 02.05.2025
        -> By changing to monthly view, the following range should be selected: 31.03.2025 - 04.05.2025

      In the example video(.gif), the current behavior is shown and et the end of the video the desired behavior is shown by manual selection.

      Andrey Marten (DevExpress Support) 2 days ago

        Hello,

        Thank you for the update. If I correctly understand it, you wish to adjust the number of weeks as well as the start date selected in the view and navigator. In this case, it should be sufficient to change the Start property in your scheduler:

        C#
        scheduler.ActiveViewChanged += (s, args) => { if (scheduler.ActiveViewType != ViewType.MonthView) return; var date = scheduler.SelectedInterval.Start.Date; scheduler.Start = new System.DateTime(date.Year, date.Month, 1); scheduler.Views.MonthView.WeekCount = 5; };

        Please try this implementation and check if the resulting behavior meets your requirements.

        Regards,
        Andrey

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.