Reputation: 325
I have placed a calendar control and a button control inside a popup control.
The problem I am facing:
The problem is that on the first click the popup receives focus and only on the second click the event triggers.
Code
<Popup
x:Name="Popup"
Grid.Row="1"
AllowsTransparency="True"
Focusable="True"
IsOpen="False"
Placement="Bottom"
PlacementTarget="{Binding ElementName=Border}"
StaysOpen="False">
<Border>
<StackPanel>
<Calendar></Calendar>
<Button Click="Button_Click"></Button>
</StackPanel>
</Border>
</Popup>
Upvotes: 3
Views: 545
Reputation: 169420
Handle the SelectedDatesChanged
event for the Calendar
and call Mouse.Capture(null)
:
private void Calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
{
Mouse.Capture(null);
}
Upvotes: 3