- 经验
- 19
- 金币
- 67
- 游币
- 97
- 最后登录
- 2011-1-18
- 注册时间
- 2010-8-27
- 帖子
- 8
- 积分
- 24
- 阅读权限
- 10
- UID
- 3544

- 游币
- 97
- 金币
- 67
- 经验
- 19
- 积分
- 24
- 帖子
- 8
|
发表于 2010-8-30 11:52:41
|显示全部楼层
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace WpfApplication2
- {
- /// <summary>
- /// MainWindow.xaml 的交互逻辑
- /// </summary>
- public partial class MainWindow : Window
- {
- delegate void WillHide();
- private WillHide willHide;
- public MainWindow()
- {
- InitializeComponent();
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("Main");
- }
- private void button1_Click(object sender, RoutedEventArgs e)
- {
- TabItem ti = new TabItem();
- ti.Header = "aaaa";
- UserControl5 u5 = new UserControl5();
- ti.Content = u5;
- tabControl1.Items.Add(ti);
- tabControl1.SelectedItem = ti;
- }
- }
- }
复制代码 这个是主窗体的cs文件- <Window x:Class="WpfApplication2.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="MainWindow" Height="418" Width="639" xmlns:my="clr-namespace:WpfApplication2" Loaded="Window_Loaded" ShowInTaskbar="False">
- <Grid>
- <TabControl Height="287" HorizontalAlignment="Left" Margin="22,41,0,0" Name="tabControl1" VerticalAlignment="Top" Width="485">
- <TabItem Header="第一" Name="tabItem1" DataContext="{Binding}">
- <Grid></Grid>
- </TabItem>
- </TabControl>
- <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="22,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
- </Grid>
- </Window>
复制代码 这个是主窗体的xaml文件 |
|