// This manages the creation and addition of new tab items to the tab control
    // It also sets up the subscription to the event in the uscEstimate control
    private void CreateAndAddTabItem(string header)
    {
        var tab = new TabItem {
            Header = header
        };

        tbcMain.Items.Add(tab);
        var uscEstimate = new uscEstimate();

        uscEstimate.AddNewItemEventHandler += AddNewItemEventHandler;
        tab.Content = uscEstimate;
        tab.Focus();
    }
Esempio n. 2
0
    // Create a new UserControl and raise (publish) our event
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        var control = new uscEstimate();

        RaiseAddNewItemEventHandler(control);
    }