tags:

views:

92

answers:

2

on the click event of a button i have to create two tabs below the button

private void bnOpen_Click(object sender, RoutedEventArgs e) {

}

A: 

You can do something like following:

  1. Create a TabControl user control with all of the tabs that you want to display.
  2. Drag a place holder on your asp.net page, for example phTabHolder.
  3. Add the user control to place holder control upon button click event, and show/hide the tab pages that you want to display. For instance, phTabHolder.Controls.Add(m_UCtlMyTabControl)

See this for dynamically adding the a control.

KMan
A: 

What i did is here :

xaml :

Themes:ThemeManager.StyleKey="SelectorDropDownButtonStyle"/>

                    <TextBox x:Name="txtFolderName" Themes:ThemeManager.StyleKey="TextBox"  IsReadOnly="True" Grid.Column="0" />
             </Grid>

    <Controls:TabControl x:Name="tbc" HorizontalAlignment="Stretch" Width="auto" Grid.Row="1" HorizontalContentAlignment="Stretch">
                        <Controls:TabControl.Items >
                            <Controls:TabItem x:Name="brw" Header="Browse" Height="auto">
                    <Grid >
                            <Border x:Name="PopupOuterBorder" Themes:ThemeManager.StyleKey="ReportSelectorOuterBorder"/>
                            <Border x:Name="PopupInnerBorder" Background="#404040" Themes:ThemeManager.StyleKey="ReportSelectorPopupInnerBorder">
                            <ScrollViewer x:Name="scrollBar"   HorizontalScrollBarVisibility="Auto" Height="100" Themes:ThemeManager.StyleKey="TreeScrollViewer" >
                            <Browser:FolderBrowser x:Name="folderPickerTree"   SelectionChanged="tree_SelectionChanged"    ></Browser:FolderBrowser>
                            </ScrollViewer>
                            </Border>
                    </Grid>
            </Controls:TabItem>
            <Controls:TabItem Header="Search" Height="auto" >

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <TextBox x:Name="tbSearch" Grid.Row="0" Grid.Column="0" Themes:ThemeManager.StyleKey="TextBox" TextChanged="SearchTextChangeEvent" />
                    <Button x:Name="bnSearch" Grid.Row="0" Grid.Column="1"  Themes:ThemeManager.StyleKey="Button"  Click="bnSearch_Click" Content="Search"/>
                    <ListBox x:Name="displayfolderList" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1" Height="30"></ListBox>
                </Grid>
            </Controls:TabItem>
        </Controls:TabControl.Items>       
        </Controls:TabControl>

code Behind :

public FolderPickerControl() { InitializeComponent(); tbc.Visibility = Visibility.Collapsed; }

private void bnOpen_Click(object sender, RoutedEventArgs e) {

        if (IsDesignTime)
            return;
        brw.IsSelected = true;    
        if (tbc.Visibility != Visibility.Visible)
        {

            tbc.Visibility = Visibility.Visible;
        }
        else
        {
            tbc.Visibility = Visibility.Collapsed;
        }
    }
Malcolm