I have created a Web Browser control in a TabControl.I want to set the Header of the TabItem to the Document's title of the Web Browser. I used the following code in the Navigated Event of the WebBrowser
dynamic doc = tabBrowser.Document; //tabBrowser is the name of WebBrowser Control
tab.Header = doc.Title; //tab is the name of the Tab Item
But this piece of code doesn't work as it should.The header changes only for a few site. How can i set the Header of the tabItem to the Document's Title Value?
Here is the navigated function:
public void tabBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
urlTextBox.Text = tabBrowser.Source.ToString();
myHistory.addToHistory(tabBrowser.Source.ToString());
BookMarks.addBookmark(tabBrowser.Source.ToString());
dynamic doc = tabBrowser.Document;
tab.Header = doc.Title;
}