Skip to content

Focus issue with Calendar in Dialog #3971

Open

Description

@corvinsz

Bug explanation

After having selected a day in a Calendar in a dialog, users have to click twice to close the dialog.
It seems like the first click only restores focus to the dialog (or window)?

Here is an example where I have to click the "OK" button twice to for the dialog to close:

CalendarInDialog.mp4

Version

5.3.0

Activity

  1. changed the title [-]Focus issu with Calendar in Dialog[/-] [+]Focus issue with Calendar in Dialog[/+] on Nov 13, 2025
  2. corvinsz commented on Nov 14, 2025

    @corvinsz
    MemberAuthor

    After some research I was surprised to see that this is a WPF "issue".
    From my understanding it's by design and not considered a bug, which I find very odd.
    source 1, source 2, source 3

    @Keboo
    The following is a workaround for this issue.
    Thoughts on adding an AP (e.g. CalendarAssist:SingleClickDefocus="True")? Or should consumers be responsible of handling this problem themself?

    private void Calendar_GotMouseCapture(object sender, MouseEventArgs e)
    {
        UIElement originalElement = e.OriginalSource as UIElement;
        if (originalElement is CalendarDayButton || originalElement is CalendarItem)
        {
            originalElement.ReleaseMouseCapture();
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugevaluation requiredItems is pending review or evaluation by the team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions