5

I would like to have master WPF form with tab control where each tab contains one independent WPF form. Those forms do not depend on each other, so I thought it will be easier to develop each of them separately and then just embed them into master form.

Number of forms is known, so there is no need for dynamic plugin system.

zendar
  • 13,384
  • 14
  • 59
  • 75

3 Answers3

8

When you use a Frame or NavigationWindow you can have it load different xaml Pages and even html. You can also make it act like a browser with forward and backward navigation. See http://msdn.microsoft.com/en-us/library/ms750478.aspx

You could put a Frame on each tab and have it load a certain Page.

<Window x:Class="PluginApplication.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <DockPanel>
        <Frame Name="frame" NavigationUIVisibility="Visible" Source="SomePage.xaml" />
    </DockPanel>
</Window>

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    WindowTitle="Page Title"
    WindowWidth="500"
    WindowHeight="200">
  Hello world
</Page>
Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
4

Make the child forms derive from UserControl, in the master form add a tab control with one of those user controls inside each tab.

Nir
  • 29,306
  • 10
  • 67
  • 103
  • Nir, This is the solution I was leaning toward. I'm sure I can figure it out, but perhaps you wouldn't mind posting the xaml.cs of your new UserControl class, then how you would post the content of your custom xaml into say, MainWindow.xaml. A concrete example (even if trivial would be helpful) – C. Tewalt Sep 10 '15 at 04:46
1

I prefer make this with userControl First create User control enter image description here

after, include reference of this userControle in another place enter image description here

anywhere in the frmHome...

 <DockPanel>
      <Entity:ucContactList/>
 </DockPanel>
Davi Menezes
  • 507
  • 1
  • 5
  • 10