usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.Media.Imaging;usingSystem.Windows.Shapes;namespaceWPF controls are bound to each other {/// <summary> ///the interactive logic of Window2.xaml/// </summary> Public Partial classWindow2:window { PublicWindow2 () {InitializeComponent (); } //When you click Open, inti =0; TabItem tab; TextBox TB; DataGrid DG; Private voidMenuitem_click_1 (Objectsender, RoutedEventArgs e) {tab=NewTabItem ();//Build Tabtab. Header ="New Window"+ (i+1);//Name of new tabTABCONTROL1.ITEMS.ADD (tab);//Tab CollectionTabcontrol1.selectedindex=i; TB=NewTextBox (); Tb. Width= $; Tb. Height= $; if(i==0) {tab. Content=TB; } tab. MouseDoubleClick+ = Tab_mousedoubleclick;//Double-click the Close tabI++; } Private voidTab_mousedoubleclick (Objectsender, MouseButtonEventArgs e) {TabItem s=(TabItem) sender; TabControl1.Items.Remove (s); }
The use of WPF TabControl controls