RadCalendar's DisplayDateChanged event being fired when docking/undocking from the RadDocking Control

7 posts, 0 answers
  1. Usman
    Usman avatar
    18 posts
    Member since:
    Dec 2018

    Posted 24 Sep 2019 Link to this post

         Hi,

    I'm facing an issue with RadCalendar placed inside a RadDocking control. The DisplayDateChanged event is called whenever I dock or undock the calendar from the docking control. I've bound a data refresh command to the said event, but dock/undock causes the command to be fired without being needed.

    Here is the Xaml:

    <telerik:RadCalendar>

    <behaviors:EventTrigger EventName="DisplayDateChanged">
           <behaviors:InvokeCommandAction Command="{Binding Path=RefreshDataCommand}" CommandParameter="{Binding                        ElementName=ctrlCalendarView, Path=DisplayDate}">
    </behaviors:InvokeCommandAction>
    </telerik:RadCalendar>

    RefreshDataCommand is coming from ViewModel.

    What the issue is this, please look into the matter.

    Thanks.

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    539 posts

    Posted 27 Sep 2019 Link to this post

    Hello Usman,

    Thank you for the shared code. 

    I tested the described scenario in a sample project, however on my end the DisplayDate is not changed while docking/undocking a RadPane with a RadCalendar. That is why I am attaching the project I used for testing purposes. May I ask you to check it out and let me know, if I am missing something? If possible, can you modify the sample project in order to reproduce the observed on your end behavior and send it back? This will hopefully allow me to replicate the same result and investigate it.

    Thank you in advance for any help you can provide.

    Regards,
    Vladimir Stoyanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Usman
    Usman avatar
    18 posts
    Member since:
    Dec 2018

    Posted 09 Oct 2019 in reply to Vladimir Stoyanov Link to this post

    Hi Vladimir,

    Thanks for your time. The issue can be reproduced by binding RadCalendar.DisplayDate to a property inside ViewModel easily. When DisplayDate is bound to ViewModel, then DisplayDateChanged event is fired on Dock/Undock to/from RadDocking.

  4. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    539 posts

    Posted 10 Oct 2019 Link to this post

    Hello Usman,

    Thank you for the update. 

    I tested this scenario in the attached project from my last reply, however I was not able to reproduce the described behavior. I am attaching a video demonstrating my attempt (you can drag&drop the video in Internet Explorer in order to watch it). In the video you can observe that the DisplayDateChanged event is only thrown when the display date is changed from the UI and it is not thrown when the pane with the RadCalendar is docked/undocked. 

    Can you check out the provided video and let me know, if I am missing something? If that is not the case, can you modify the sample project in order to reproduce the DisplayDateChanged event being fired when a pane is docked/undocked and send it back?

    I am looking forward to your reply.

    Regards,
    Vladimir Stoyanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Usman
    Usman avatar
    18 posts
    Member since:
    Dec 2018

    Posted 10 Oct 2019 in reply to Vladimir Stoyanov Link to this post

    Hi Vladimir,

    I've added a DisplayDate property to you sample project and bound that to the calendar.DisplayDate. The command fires everytime I take out the calendar control from Docking or place it back to the dock. Your project with updated code is hosted on the github here

    https://github.com/waqasulislam/RadCalendarIssue

     

     

    Thanks.

  6. Usman
    Usman avatar
    18 posts
    Member since:
    Dec 2018

    Posted 14 Oct 2019 in reply to Vladimir Stoyanov Link to this post

    Hi Vladimir,

    I've updated the code to reproduce the same issue with listbox too. Whenever the listbox is docked-in/docked-out of the RadDock control,its selectionchanged event is fired. I don't need this behavior. Please have a look at the repository.

  7. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    539 posts

    Posted 15 Oct 2019 Link to this post

    Hello Usman,

    Thank you for the updates and the provided projects. 

    I investigated the described scenario and it turns out that what you have observed is the expected behavior. The reason for the DisplayDateChanged and SelectionChanged events being fired is that when the RadPane is floated/docked its contents (the ListBox or RadCalendar) are taken out of the visual tree. This leads to their DataContext being changed and when there is a property of those objects bound to a property in the viewmodel, the binding is evaluated with the default value of the dependency property. This causes the corresponding events to be fired (DisplayDateChanged/SelectionChanged). 

    Can you elaborate on your scenario so that I can better assist you? You mentioned that you have bound a data refresh command to the DisplayDateChanged event, however if the DisplayDate property is bound to a property in your viewmodel, you can execute the data refresh command when the property changes. Would such an approach be suitable for your scenario?

    I am looking forward to your reply.

    Regards
    Vladimir Stoyanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top