void popup_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e) { if (!subsequentCall) { if (DropDownContent != null) { if (DropDownContent.GetType().GetProperty("ActiveSmartPart") != null) { object smartPart = DropDownContent.GetType().GetProperty("ActiveSmartPart").GetValue(DropDownContent, null); if (smartPart != null) { subsequentCall = true; if (smartPart is UserControl) { if (((UserControl)smartPart).Content != null) { object content = ((UserControl)smartPart).Content; if (content != null && content is Grid) { Grid grid = (Grid)content; if (grid.RowDefinitions.Count == 2) { RowDefinition rowDef = grid.RowDefinitions[0]; if (rowDef.ActualHeight > (popup.Height / 3)) { popup.Height = rowDef.ActualHeight + 200; double newWidth = (rowDef.ActualHeight + 200) * 1.618; if (newWidth > popup.Width) { popup.Width = newWidth; } } } } } } } } } } }