I have some control in a stackpanel.
When I right click on the panel it gives me a context menu and I can edit the text of these control.
Here I used TextBlock to display the data and TextBox to edit the data (When TextBox is visible TextBlock become collapsed and vice versa)
I want to select all the text of the TextBox and focus it when the TextBox is visible.
I tried using Interaction. But didn't work out :(
Is there any way to do this?
For example : When the TextBox is visible I can fire some command in my viewmodel and select all the text from my viewmodel.
<TextBlock Text="{Binding MachineResponseText}" Visibility="{Binding IsEditing, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=true}"/>
<TextBox x:Name="MachineResponseTextBox" Text="{Binding MachineResponseText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding IsEditing, Converter={StaticResource BoolToVisibilityConverter}}">
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="IsVisible" Value="True">
<!--Is there any way to select all the text when this textbox is visible?-->
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>