代码之家  ›  专栏  ›  技术社区  ›  zendar

如何将一个WPF表单嵌入到另一个WPF表单中?

  •  4
  • zendar  · 技术社区  · 17 年前

    我希望有一个主WPF表单和选项卡控件,其中每个选项卡包含一个独立的WPF表单。这些表单互不依赖,所以我认为单独开发它们,然后将它们嵌入主表单中会更容易。

    表单的数量是已知的,所以不需要动态插件系统。

    4 回复  |  直到 17 年前
        1
  •  7
  •   Lars Truijens    17 年前

    当你使用 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>
    
        2
  •  4
  •   Nir    17 年前

    使子窗体从UserControl派生,在主窗体中添加一个选项卡控件,每个选项卡中都有一个这样的用户控件。

        3
  •  1
  •   Davi Menezes    9 年前

    我更喜欢用userControl做这个 enter image description here

    enter image description here

    在家庭的任何地方。。。

     <DockPanel>
          <Entity:ucContactList/>
     </DockPanel>
    
    推荐文章