解决方案 »

  1.   

    内容控件都有Children.add(你的自定义控件名)  在你的tabControl 里面的某个项里面添加grid  然后grid .Children.add 就可以了
      

  2.   


                TabItem temptb = new TabItem();
                LinearGradientBrush _brush = new LinearGradientBrush();            Color sColor = Color.FromArgb(255,122, 210, 231);
                Color eColor = Color.FromArgb(255, 14, 75, 133);
                _brush.StartPoint = new Point(0.5, 0);
                _brush.EndPoint = new Point(0.5, 1);
                _brush.GradientStops.Add(new GradientStop(sColor, 0.0));
                _brush.GradientStops.Add(new GradientStop(eColor, 1.0));
                temptb.Width = 70;
                temptb.Header = textBox1.Text;
                temptb.Background = _brush;
                tabControl1.Items.Add(temptb);我是这样添加进去的,这个Grid要怎么添加呢。
      

  3.   

                TabItem temptb = new TabItem();
                LinearGradientBrush _brush = new LinearGradientBrush();            Color sColor = Color.FromArgb(255, 122, 210, 231);
                Color eColor = Color.FromArgb(255, 14, 75, 133);
                _brush.StartPoint = new Point(0.5, 0);
                _brush.EndPoint = new Point(0.5, 1);
                _brush.GradientStops.Add(new GradientStop(sColor, 0.0));
                _brush.GradientStops.Add(new GradientStop(eColor, 1.0));
                temptb.Width = 70;
                temptb.Header = "111";
                temptb.Background = _brush;            Grid tempGrid = new Grid();
                tempGrid.Background =new SolidColorBrush(Colors.Yellow);            temptb.Content = tempGrid;
                tabControl1.Items.Add(temptb);这样就可以了.可以把tempGrid换成UserControl,自己已经写好的界面
      

  4.   

    顺便说一下,WPF不应该这样用,这还是Winform的方法.
      

  5.   

    刚转过来,WPF有什么好的方法?有什么好书介绍下不。晚些结分你们。
      

  6.   

    主要还是网上资源多一些,看起来也方便.书的话,我自己买了两本 <WPF编程宝典>,<深入浅出WPF>http://download.csdn.net/detail/wudidagou/6312239,都挺不错.