I'm new to wpf. I'm working on a new application. In my application, I use tab control. Two tab items are used. In one tab item data grid is used to display.
On click on datagrid row i want to set the focus to the next tab item.

on Row\_DoubleClick, the code as follows...

```
 if (dgMain.SelectedItem == null)
                return;
 cardType = ((Entity.CardType)dgMain.SelectedItem);

 txtCardType.Text = cardType.card_type_desc;
 tabMain.SelectedItem = tbiConfig;

```

This code is not working. focus is not moving to the other tab.

Folks, can you help me?

------ xaml is as follows

```
<Grid>
    <Label Content="Card Type" Height="35" HorizontalAlignment="Left" Margin="17,12,0,0" Name="lblHeader" VerticalAlignment="Top" FontSize="18" Width="193" />
    <TabControl Height="235" HorizontalAlignment="Left" Margin="12,53,0,0" Name="tabMain" VerticalAlignment="Top" Width="576">
        <TabItem Header="Configure" Name="tbiConfig">
            <Grid>
                <Button Content="Save" Height="23" HorizontalAlignment="Left" Margin="450,137,0,0" Name="btnSave" VerticalAlignment="Top" Width="75" Click="btnSave_Click" />
                <Label Content="CardType" Height="28" HorizontalAlignment="Left" Margin="14,34,0,0" Name="lblCardType" VerticalAlignment="Top" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="130,36,0,0" Name="txtCardType" VerticalAlignment="Top" Width="395" />
            </Grid>
        </TabItem>
        <TabItem Header="Search" Name="tbiSearch">
            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Label Content="CardType" Height="28" HorizontalAlignment="Left" Margin="10,10,0,0" Name="lblSearchCardType" VerticalAlignment="Top" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="126,12,0,0" Name="txtSearchCardType" VerticalAlignment="Top" Width="333" />
                <Button Content="Search" Height="23" HorizontalAlignment="Left" Margin="473,12,0,0" Name="btnSearch" VerticalAlignment="Top" Width="75" Click="btnSearch_Click" />
                <DataGrid AutoGenerateColumns="false" Height="148" HorizontalAlignment="Left" Margin="15,49,0,6" Name="dgMain" VerticalAlignment="Center" Width="533" ItemsSource="{Binding}" CanUserAddRows="True" GridLinesVisibility="All" HorizontalGridLinesBrush="LightGray" IsEnabled="True" IsReadOnly="True" RowHeight="23" HorizontalContentAlignment="Left"  VerticalGridLinesBrush="LightGray" VerticalContentAlignment="Center" MouseDoubleClick="dgMain_MouseDoubleClick">
                    <DataGrid.ItemContainerStyle>
                        <Style TargetType="DataGridRow">
                            <EventSetter Event="MouseDoubleClick" Handler="Row_DoubleClick"/>
                        </Style>
                    </DataGrid.ItemContainerStyle>
                    <DataGrid.Columns  >
                        <DataGridTextColumn Header="ID" Binding="{Binding Path=card_type_id}" Width="100" />
                        <DataGridTextColumn Header="Description" Binding="{Binding Path=card_type_desc}" Width="400"  />
                    </DataGrid.Columns>
                </DataGrid>

            </Grid>
        </TabItem>
    </TabControl>
</Grid>

```