Hi,
Do not place the WebControl directly in the TabControl. In order for the WebControl starts to function, its window handle must be created, which requires the WebControl to be connected to the visual tree. A TabControl does not connect all tabs to the visual tree, it only connects the current tab to the visual tree. This causes only the WebControl in the selected tab works.
You can use the following method to workaround this issue:
1. Instead of placing the WebControl inside the TabControl, place them inside a Grid. The TabControl will contain the tab header only. So the visual tree will be like this:
Code:
Window
+--TabControl
| +--TabHeader1
| +--TabHeader2
+--Grid
+--WebControl1
+--WebControl2
2. Handle the TabControl's SelectionChanged event. Inside the event handler you can dynamically set only one WebControl inside the Grid to Visible (set its Visibility to Visible and set all others to Hidden) based on the TabControl's SelectedIndex property.
Our TabbedBrowser sample uses a similar technique. Instead of using a Grid, we uses our own DockView class (m_WebViewsHost in MainWindow.xaml.cs), which works very similar to a Grid control on this regard. Internally a DockView uses a Grid to holds all Items and setting a DockView's SelectedIndex sets the item at the specified index to Visible and all other items to Hidden.
Hope this helps. Please feel free to let us know if you still have any questions.
Thanks!