void UpdatePopupMaxHeight (double height)
{
if (_popup != null && _popup.Child is FrameworkElement) {
if (height == double.PositiveInfinity)
height = Application.Current.Host.Content.ActualHeight / 2.0;
((FrameworkElement) _popup.RealChild).MaxHeight = height;
}
}