Example #1
0
        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);
        }
Example #2
0
 private static object AddScrollViewer(this UserControl userControl, UIElement painel, ScrollViewer parent)
 {
     if (parent.Content == null)
     {
         parent.Content = new StackPanel();
     }
     if (parent.Content is StackPanel)
     {
         return(userControl.AddStackPanel(painel, parent.Content as StackPanel));
     }
     return(painel);
 }