主面板上有一个Calendar控件,点击选择了日期后,如果点击确认按钮,需要点击两次。这个问题的解决方法如下:

    private void calendar1_PreviewMouseUp(object sender, MouseButtonEventArgs e)
    {
        if (Mouse.Captured is CalendarItem)
        {
            Mouse.Capture(null);
        }
    }
 
本人亲自验证。

相关文章: