internal static void InvalidateScrollBarVisibility(ScrollViewer submenuScrollViewer) { if (submenuScrollViewer != null) { // The scroll viewer needs to re-evaluate the visibility of the scrollbars // and that happens in its MeasureOverride call. Also note that we need to // make this invalidate call async because we may already be within a // ScrollViewer measure pass, by which we would miss the boat. submenuScrollViewer.Dispatcher.BeginInvoke((Action)delegate() { submenuScrollViewer.InvalidateMeasure(); }, DispatcherPriority.Render); } }