Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Created Unassigned: DatePicker in DropdownButtonContent [21888]

$
0
0
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

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>