4

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.

4

3 回答 3

7

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>
于 2009-02-14T18:18:38.820 回答
4

使子窗体派生自 UserControl,在主窗体中添加一个选项卡控件,其中每个选项卡内都有这些用户控件之一。

于 2009-02-15T10:24:30.923 回答
1

我更喜欢用 userControl 首先创建用户控件 在此处输入图像描述

之后,在另一个地方包含这个 userControle 的引用 在此处输入图像描述

在 frmHome 的任何地方...

 <DockPanel>
      <Entity:ucContactList/>
 </DockPanel>
于 2016-10-19T20:27:29.953 回答