How to load one wpf into another?

1

I will try to make the context clear. I have a lot of graphic content inside my main WPF, so I would like to work it separately. For this I have my main.wpf and apart (as an example) contenido1.wpf and to instantiate it I was using <local:contenido1.wpf/> but he throws me the following error.

This if I create as a page

System.InvalidOperationException: 'Page sólo puede tener una Window o un Frame como elemento primario.'

This if I think as a window

System.Windows.Markup.XamlParseException
HResult=0x80131501
Mensaje = Se produjo una excepción al establecer la propiedad 'System.Windows.Controls.ContentControl.Content'.
Origen = PresentationFramework
Seguimiento de la pila:
en System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)

Excepción interna 1:
InvalidOperationException: Window debe ser la raíz del árbol. No se puede agregar Window como elemento secundario de Visual.

Review a couple of examples but I still do not understand how to correctly insert. If anyone can help me thank you.

    
asked by Christopher Vivar Vivar 04.02.2018 в 05:04
source

1 answer

0

Thanks to Pikoh's comment and help, I understood what I should do and how.

A new User Control is added and in the main or recurrent container that is being worked on it can be instantiated, using <local:/> (in my case) or defining the directory within xmlns:UserControl and in this way call <UserControl:/>

    
answered by 06.02.2018 в 06:25