I have following code -
WebBrowser bw = new WebBrowser();
Grid gr = new Grid();
gr = ((ClosableTab)tabControl1.Items[tabControl1.SelectedIndex]).Content as Grid;
Grid grc = new Grid();
grc = gr.Children[1] as Grid;
bw = grc.Children[0] as WebBrowser;
bw.Source = new Uri(txtBoxUrl.Text);
Howvever I am able to fulfill my requirement, but all the elements are hardcoded. I know there is a better way and a single line of code. Please suggest a standard code to do this.
Update
<TabControl x:Name="tabControl1" FontWeight="UltraBlack" BorderThickness="1" BorderBrush="Black" Background="LightBlue" >
<local:ClosableTab Background="LightBlue" Title="Preview" x:Name="PreviewWindow">
<Grid>
<Border Name="mask" Background="Black" CornerRadius="5"/>
<Grid>
<Grid.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}"/>
</Grid.OpacityMask>
<WebBrowser Name="webBrowser" Source="http://www.google.com" Margin="0" />
</Grid>
</Grid>
</local:ClosableTab>
<local:AddableTab Background="LightBlue">
Click '+' to add a New Tab
</local:AddableTab>
</TabControl>