Пример #1
0
        public static object AddControl(this UserControl userControl, object control, object parent = null,
                                        SelectionChangedEventHandler selectionChanged = null, object[] controls = null)
        {
            var content = parent ?? userControl.Content;

            if (content == null || content is Grid)
            {
                return(userControl.AddTabControl(control as UIElement, selectionChanged));
            }

            if (content is TabControl)
            {
                return(userControl.AddTabItem(control as UIElement, content as TabControl, controls));
            }

            return(control);
        }