public TabItem AddTabWebView(Uri url, int flag = 0) { tabDynamic.DataContext = null; temp++; int count = _tabItems.Count; counter++; // create new tab item TabItem tab = new TabItem(); if (flag == 0) { tab.Header = string.Format(url.ToString()); } else { tab.Header = "Help"; } tab.Name = string.Format("tab{0}", counter); tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate; tab.Background = new SolidColorBrush(Color.FromRgb(230, 234, 238)); tab.BorderBrush = Brushes.LightGray; tab.MinWidth = 100; tab.Width = 150; tab.MaxWidth = 150; Webview page = new Webview(); Grid g = new Grid(); page.setUrl(url); g = page.browser; page.Content = null; tab.Content = g; _tabItems.Insert(count - 1, tab); tabDynamic.DataContext = _tabItems; // select newly added tab item tabDynamic.SelectedItem = tab; return(tab); }
public TabItem AddTabHtmlView(Journal j) { tabDynamic.DataContext = null; temp++; int count = _tabItems.Count; counter++; // create new tab item TabItem tab = new TabItem(); tab.Name = string.Format("tab{0}", counter); tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate; tab.Header = j.getname(); tab.Background = new SolidColorBrush(Color.FromRgb(230, 234, 238)); tab.BorderBrush = Brushes.LightGray; tab.MinWidth = 100; tab.Width = 150; tab.MaxWidth = 150; Webview page = new Webview(); Grid g = new Grid(); page.webView.NavigateToString(j.gethtmlStats()); g = page.browser; page.Content = null; tab.Content = g; _tabItems.Insert(count - 1, tab); tabDynamic.DataContext = _tabItems; // select newly added tab item tabDynamic.SelectedItem = tab; return(tab); }