tags:

views:

1618

answers:

3

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.

+2  A: 

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
+4  A: 

Check out this MSDN article by Josh Smith. It is an excellent solution for your question.

WPF Apps With The Model-View-ViewModel Design Pattern

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

Tawani
+1 Exactly what I was going to recommend.
Bryan Anderson
+1  A: 

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