I have following hierarchy -
<TabControl x:Name="tabControl1" FontWeight="Black" BorderThickness="1" BorderBrush="Black" Background="LightBlue" >
<local:ClosableTab Background="LightBlue" Title="New Tab" 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" Navigated="webBrowser_Navigated" />
</Grid>
</Grid>
</local:ClosableTab>
</TabControl>
Questions
- How can I bind WebBrowser with CommandParameter, by selected TabIndex of tabControl1
I am trying following code -
<Button Name="btnRefresh" Content="Refresh" Command="{Binding Path=Refresh}" CommandParameter="{Binding ElementName=tabControl1,Path=SelectedIndex}"></Button>
- How can I do this conditionally. e.g. If SelectedIndex>3 then Command should fire.
Update
My goal is to refresh web browser via ViewModel Command. The .xaml file has differen tabs with its own WebBrowsers, so by SelectedIndex, I can figure out that WebBrowser, which I want to pass in CommandParameter.