I have started a modal dialog from a main xaml page. when ok is click on the modal I need to add a tab to the main dialog. I tried this code but is not working. When the modal dialog is clicked, the new tab is not being added to the main page. I'm running on deadline
Please any help is very welcomed.
Main page entry
Addind tab functionCode:public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); if (((App)Application.Current).datacol.Count > 0) //checks for entry //before adding tab { addNewTab(); DataContext = this; } }
Pop up codeCode:private void addNewTab() { TabItem item = new TabItem(); item.Header = "New tab"; this.tabCases.Items.Add(item); }
Code:private void OKButton_Click(object sender, RoutedEventArgs e) { ((App)Application.Current).datacol.Add(new RawData()); int ct = ((App)Application.Current).datacol.Count; ((App)Application.Current).RootVisual = new MainPage(); //send // view to main page ?? this.DialogResult = true; }



