I have a TabItem which contains a calendar control and a button. The issue is that when the calendar\'s selected date is the same as the previously selected date, the button tak
You could simply write:
Mouse.Capture(null);
This will solve the issue of mouse holding focus
This was the best answer I found on the web. It's still not perfect because it doesn't help with buttons that are marked as IsDefault or IsCancel
protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
{
base.OnPreviewMouseUp(e);
if (Mouse.Captured is Calendar || Mouse.Captured is System.Windows.Controls.Primitives.CalendarItem)
{
Mouse.Capture(null);
}
}