protected override void OnDropDownClosed(EventArgs e)
{
base.OnDropDownClosed(e);
if (Mouse.Captured == this) Mouse.Capture(null);
if (focusedElement != null) focusedElement.LostKeyboardFocus -= OnFocusedElementLostKeyboardFocus;
focusedElement = null;
ShowPopupOnTop = false;
galleryPanel.Width = double.NaN;
scrollViewer.Height = double.NaN;
}