Brie
Brie

Reputation: 2359

Why does my WPF button require 2 clicks to invoke?

I have a very simple WPF window, with a Calendar control and a Button. If I select (single-click) a date in the Calendar and then immediately single-click the Button, its Command is not executed. Only after I single-click the button a second time is the button Command invoked. (I notice that only after I click the button once will a mouse-over change the color of the button.) How can I get the (expected) behavior of not requiring 2 clicks to get the button to "work"? (using .NET 4.6.1)

Upvotes: 1

Views: 704

Answers (1)

Gabriel
Gabriel

Reputation: 411

Try to add following code to your Calendar_SelectedDatesChanged event:

Mouse.Capture(null);

Upvotes: 3

Related Questions