void OnDropDownClosed(object sender, EventArgs e)
{
galleryPanel.Width = Double.NaN;
galleryPanel.IsGrouped = false;
galleryPanel.MinItemsInRow = currentItemsInRow;
galleryPanel.MaxItemsInRow = currentItemsInRow;
//galleryPanel.InvalidateMeasure();
popupControlPresenter.Content = null;
//galleryPanel.Opacity = 0;
/*Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)(() =>
{*/
controlPresenter.Content = galleryPanel;
Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (ThreadStart)(() =>
{
if ((quickAccessGallery == null) || ((quickAccessGallery != null) && (!quickAccessGallery.IsDropDownOpen)))
{
IsSnapped = false;
//galleryPanel.Opacity = 1;
}
}));
//}));
//snappedImage.Visibility = Visibility.Collapsed;
if (DropDownClosed != null) DropDownClosed(this, e);
if (Mouse.Captured == this) Mouse.Capture(null);
Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (ThreadStart)(() =>
{
GalleryItem selectedContainer = ItemContainerGenerator.ContainerFromItem(SelectedItem) as GalleryItem;
if (selectedContainer != null) selectedContainer.BringIntoView();
}));
dropDownButton.IsChecked = false;
canOpenDropDown = true;
}