WPF Calendar Control holding on to the Mouse

后端 未结 4 771
孤独总比滥情好
孤独总比滥情好 2021-01-11 14:20

So I dropped the standard WPF Calendar control on the MainWindow.xaml in a brand new WPF App in VS2010. If I click on a day in the calendar and then try to cli

4条回答
  •  迷失自我
    2021-01-11 15:09

    The calendar control is hosted in a popup, and captures the mouse. When you click somewhere else the first time, the capture sends the click to the popup, which, realizing that you've clicked outside of itself, closes. The click therefore does not go to the button.

    You can see the same effect when using a ComboBox. Drop it down, then click on a button. It won't click the button.

    Unfortunately, it's unlikely you can do anything to alter this behavior.

    Edit: More recent versions of .NET make a solution possible. See Eren's answer.

提交回复
热议问题