我想拥有带有选项卡控件的主WPF表单,其中每个选项卡包含一个独立的WPF表单.这些形式并不相互依赖,所以我认为将它们分开开发更简单,然后将它们嵌入到主形式中.
表单数量是已知的,因此不需要动态插件系统.
当您使用Frame或NavigationWindow时,您可以使用它加载不同的xaml Pages甚至html.您还可以将其设置为具有前向和后向导航功能的浏览器.请参阅http://msdn.microsoft.com/en-us/library/ms750478.aspx
您可以在每个选项卡上放置一个框架并让它加载某个页面.
<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>
Run Code Online (Sandbox Code Playgroud)