private void OnResizeVerticalDelta(object sender, DragDeltaEventArgs e) { if (double.IsNaN(scrollViewer.Height)) scrollViewer.Height = scrollViewer.ActualHeight; scrollViewer.Height = Math.Min(Math.Max(galleryPanel.GetItemSize().Height, scrollViewer.Height + e.VerticalChange), MaxDropDownHeight); }