public static object AddPainel(this UserControl userControl, object painel, object parent = null, Orientation?orientation = null, Dock?dock = null) { var content = parent ?? userControl.Content; if (content == null || content is Grid) { return(userControl.AddContent(painel as UIElement)); } else if (content is ScrollViewer) { return(userControl.AddScrollViewer(painel as UIElement, content as ScrollViewer)); } else if (content is StackPanel) { return(userControl.AddStackPanel(painel as UIElement, content as StackPanel, orientation)); } else if (content is DockPanel) { return(userControl.AddDockPanel(painel as UIElement, content as DockPanel, dock)); } return(painel); }