I figured out the work around for this. I will post it, might help
some one else -

XAML code -

<Window x:Class="MSDNTest.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
    Width="300" Height="200">

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <TabControl x:Name="tab1">
            <TabItem Header="Tab 1.1"/>
            <TabItem Header="Tab 1.2"/>
            <TabItem Header="Tab 1.3"/>
        </TabControl>
        <TabControl x:Name="tab2" Visibility="Collapsed">
            <TabItem Header="Tab 2.1"/>
            <TabItem Header="Tab 2.2"/>
            <TabItem Header="Tab 2.3"/>
        </TabControl>
        <TabControl x:Name="tab3" Visibility="Collapsed">
            <TabItem Header="Tab 3.1"/>
            <TabItem Header="Tab 3.2"/>
            <TabItem Header="Tab 3.3"/>
        </TabControl>
        <StackPanel Orientation="Horizontal"
VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.Row="1">
            <Button Content="Tab 1" Click="Button_Click" Tag="{Binding
ElementName=tab1}"/>
            <Button Content="Tab 2" Click="Button_Click" Tag="{Binding
ElementName=tab2}"/>
            <Button Content="Tab 3" Click="Button_Click" Tag="{Binding
ElementName=tab3}"/>
        </StackPanel>
    </Grid>
</Window>

VB .NET code -

Private Sub Button_Click(ByVal sender As System.Object, ByVal e As
System.Windows.RoutedEventArgs)
        tab1.Visibility = Windows.Visibility.Collapsed
        tab2.Visibility = Windows.Visibility.Collapsed
        tab3.Visibility = Windows.Visibility.Collapsed

        Dim tab = TryCast(TryCast(sender, Button).Tag, TabControl)
        If tab IsNot Nothing Then
            tab.Visibility = Visibility.Visible
        End If
    End Sub

Best Regards!
Vishal

On Sep 14, 11:13 am, Vishal <[email protected]> wrote:
> Hi,
>
> I started learning WPF few weeks back and wanted some information on
> how to capture the following scenario -
>
> Button1.click - tabcontrol.show
> Button2.click - tabcontro2.show
> Button3.click - tabcontro3.show
>
> and so on...
>
> Is there any different / simple method / way to achieve this?
>
> Thanks!
>
> Best Regards

Reply via email to