Hi,
I have a listview and I have placed a textblock and textbox on each cell. When a listview item is selected, its textbox visibility is switched to visible, so user can change the value of the textbox. However, user needs to click twice; by the first click, the listview item is selected and user needs to click on the textbox to move the focus on the textbox.
Question is how to set the focus on textbox when the listview item is selected.
Thanks for your help
<GridViewColumnHeader="Value"Width="250">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBoxText="{BindingPath=Value,UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style>
<StyleTargetType="{x:TypeTextBox}">
<SetterProperty="Visibility"Value="Collapsed"/>
<Style.Triggers>
<DataTriggerBinding="{BindingRelativeSource={RelativeSourceMode=FindAncestor,AncestorType={x:TypeListViewItem}},Path=IsSelected}"Value="True">
<SetterProperty="Visibility"Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>