I have a data template that contains a grid. I would like to make the selected row of the grid larger (height-wise) when the user selects the row. Each cell in the row contains a rectangle for styling purposes and a textbox for data. I have the following that resizes the row when the user clicks on the rectangle, but not when they click inside the text box (which is where they are likely to click). How can I make the row resize when the user clicks in the textbox?
<!-- Mapping Rules Template --> <DataTemplate x:Key="MappingRuleTemplate"> <Grid Margin="0"> <Grid.RowDefinitions> <RowDefinition Height="26"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="20" /> <ColumnDefinition Width="150"/> <ColumnDefinition Width="75"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <!-- Shading --> <Rectangle Grid.Column="0" Style="{StaticResource TableRowShade}" Margin="0" /> <Rectangle Grid.Column="1" Style="{StaticResource TableRowShadeALT}" Margin="0" /> <Rectangle Grid.Column="2" Style="{StaticResource TableRowShade}" Margin="0" /> <Rectangle Grid.Column="3" Style="{StaticResource TableRowShadeALT}" Margin="0" HorizontalAlignment="Stretch" /> <!-- End Shading --> <Button Name="DeleteButton" Grid.Column="0" Style="{StaticResource ImageButton}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}, Path=DataContext.DeleteRuleButtonClickedCommand}" ToolTip="Delete this mapping rule" local:AttachedImage.Image="{StaticResource CancelImageSource}" > <Button.CommandParameter> <MultiBinding Converter="{StaticResource DeleteButtonConverter}"> <Binding ElementName="TableName" Path="Text" /> <Binding ElementName="FieldNumber" Path="Text" /> </MultiBinding> </Button.CommandParameter> </Button> <TextBox Name="TableName" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,4,5" Height="20" Text="{Binding TableName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" FocusManager.IsFocusScope="True" Style="{StaticResource NewRecordsStyle}" HorizontalAlignment="Stretch" /> <TextBox Name="FieldNumber" Grid.Column="2" VerticalAlignment="Center" Margin="4,0,4,5" Height="20" Width="50" Text="{Binding FieldNumber, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Center" Style="{StaticResource NewRecordsStyle}" HorizontalAlignment="Stretch" /> <TextBox Name="DynamicSQL" Grid.Column="3" VerticalAlignment="Center" Margin="4,0,4,5" Text="{Binding DynamicSQL, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NewRecordsStyle}" HorizontalAlignment="Stretch" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Height="20" Width="303" /> </Grid> </DataTemplate> <DataTemplate x:Key="MappingRuleSelectedTemplate"> <Grid Margin="0"> <Grid.RowDefinitions> <RowDefinition Height="110"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="20" /> <ColumnDefinition Width="150" Style="{StaticResource TableRowShadeALT}"/> <ColumnDefinition Width="75"/> <ColumnDefinition Width="*" Style="{StaticResource TableRowShadeALT}"/> </Grid.ColumnDefinitions> <!-- Shading --> <Rectangle Grid.Column="0" Style="{StaticResource TableRowShade}" Margin="0" /> <Rectangle Grid.Column="1" Style="{StaticResource TableRowShadeALT}" Margin="0" /> <Rectangle Grid.Column="2" Style="{StaticResource TableRowShade}" Margin="0" /> <Rectangle Grid.Column="3" Style="{StaticResource TableRowShadeALT}" Margin="0" HorizontalAlignment="Stretch" Height="110" /> <!-- End Shading --> <Button Name="DeleteButton" Grid.Column="0" Style="{StaticResource ImageButton}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}, Path=DataContext.DeleteRuleButtonClickedCommand}" ToolTip="Delete this mapping rule" local:AttachedImage.Image="{StaticResource CancelImageSource}" > <Button.CommandParameter> <MultiBinding Converter="{StaticResource DeleteButtonConverter}"> <Binding ElementName="TableName" Path="Text" /> <Binding ElementName="FieldNumber" Path="Text" /> </MultiBinding> </Button.CommandParameter> </Button> <TextBox Name="TableName" Grid.Column="1" VerticalAlignment="Center" Margin="4,0,4,5" Height="20" Text="{Binding TableName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" FocusManager.IsFocusScope="True" Style="{StaticResource NewRecordsStyle}" HorizontalAlignment="Stretch" /> <TextBox Name="FieldNumber" Grid.Column="2" VerticalAlignment="Center" Margin="4,0,4,5" Height="20" Width="50" Text="{Binding FieldNumber, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Center" Style="{StaticResource NewRecordsStyle}" HorizontalAlignment="Stretch" /> <TextBox Name="DynamicSQL" Grid.Column="3" VerticalAlignment="Center" Margin="4,0,4,5" Text="{Binding DynamicSQL, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NewRecordsStyle}" HorizontalAlignment="Stretch" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Height="100" Width="303"/> </Grid> </DataTemplate> <Style TargetType="{x:Type ListBoxItem}" x:Key="ContainerStyle"> <Setter Property="Padding" Value="0"/> <Setter Property="BorderThickness" Value="0"/> <Setter Property="ContentTemplate" Value="{StaticResource MappingRuleTemplate}" /> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource MappingRuleSelectedTemplate}" /> </Trigger> </Style.Triggers> </Style> ..... <ListBox Name="QuarterlyCompanyFieldMappingControl" ItemContainerStyle="{StaticResource ContainerStyle}" ItemsSource="{Binding QuarterlyCompanyMappings.FieldMappingCollection, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" AlternationCount="2" BorderThickness="0" Padding="0">
UIElement.IsKeyboardFocusWithinproperty.