Hi
I have a small application where a DropdownButton has a DatePicker as DropDownContent.
Use case is following:
- Open DropdownButton
- Open DatePicker
- Click on Title to select another month
- Select another month
- Click Outside of DatePicker
+They are closed, but Mouse is freezed forever (Captured)
Addon:
- It is working correctly - more or less - If DropdownButton is changed to Combobox
- It is working correctly - If DatePicker replaced to DateTimePicker
```
<StackPanel>
<xctk:DropDownButton Content="Dropdownbutton">
<xctk:DropDownButton.DropDownContent>
<StackPanel Height="200" Width="400">
<TextBlock Text="It has workaround:" />
<DatePicker Initialized="DatePicker_Initialized" />
<TextBlock Text="It has no workaround:" />
<DatePicker />
<TextBlock Text="DTPicker from Toolkit:" />
<xctk:DateTimePicker />
</StackPanel>
</xctk:DropDownButton.DropDownContent>
</xctk:DropDownButton>
</StackPanel>
```
Workaround:
```
private void DatePicker_Initialized(object sender, EventArgs e)
{
Mouse.AddPreviewMouseDownOutsideCapturedElementHandler(
(DatePicker)sender, Workaround);
}
private void Workaround(object sender, MouseButtonEventArgs e)
{
DatePicker dp = sender as DatePicker;
dp.IsDropDownOpen = false;
dp.CaptureMouse();
dp.ReleaseMouseCapture();
}
```
thanks
daniel
I have a small application where a DropdownButton has a DatePicker as DropDownContent.
Use case is following:
- Open DropdownButton
- Open DatePicker
- Click on Title to select another month
- Select another month
- Click Outside of DatePicker
+They are closed, but Mouse is freezed forever (Captured)
Addon:
- It is working correctly - more or less - If DropdownButton is changed to Combobox
- It is working correctly - If DatePicker replaced to DateTimePicker
```
<StackPanel>
<xctk:DropDownButton Content="Dropdownbutton">
<xctk:DropDownButton.DropDownContent>
<StackPanel Height="200" Width="400">
<TextBlock Text="It has workaround:" />
<DatePicker Initialized="DatePicker_Initialized" />
<TextBlock Text="It has no workaround:" />
<DatePicker />
<TextBlock Text="DTPicker from Toolkit:" />
<xctk:DateTimePicker />
</StackPanel>
</xctk:DropDownButton.DropDownContent>
</xctk:DropDownButton>
</StackPanel>
```
Workaround:
```
private void DatePicker_Initialized(object sender, EventArgs e)
{
Mouse.AddPreviewMouseDownOutsideCapturedElementHandler(
(DatePicker)sender, Workaround);
}
private void Workaround(object sender, MouseButtonEventArgs e)
{
DatePicker dp = sender as DatePicker;
dp.IsDropDownOpen = false;
dp.CaptureMouse();
dp.ReleaseMouseCapture();
}
```
thanks
daniel