现使用C#wpf,如何让tabcontrol动态加载自己编写的页面,比如tabitem1加载自己编写的page1.xaml,求代码

解决方案 »

  1.   

    查了一些资料,好像tabitem只能加载usercontrol,也尝试通过了,但就是加载不了page.xaml,一旦加载就报错“Page 只能具有 Window 或 Frame 父级。”
      

  2.   

    TabControl Name="sampleSelector" Background="White" BorderBrush="Orange">      <TabItem Header="Painting with Visuals" >
            <Frame Source="PaintingWithVisuals.xaml" Background="White" />            
          </TabItem>
          <TabItem Header="Magnifying Glass Example" >
            <Frame Source="MagnifyingGlassExample.xaml" Background="White" />            
          </TabItem>     
          <TabItem Header="Reflection Example" >
            <Frame Source="ReflectionExample.xaml" Background="White" />            
          </TabItem>       
        </TabControl> 
      

  3.   

    http://nonocast.cn/?s=dynamically+loading