I am looking for a way to show the Caret in a TextBox
when IsMouseOver="True"
. The solution using FocusManager.IsFocusScope="True"
as mentioned here does not seem to work.
Is there a way to show the Caret without having to click inside the TextBox
?
MWE:
<Window x:Class="WpfApp11.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="FocusManager.IsFocusScope" Value="True" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<TextBox Width="300" Height="22" Text="Hello World" />
</Grid>
</Window>
A TextBox
displaying the Caret after clicking on it. I want the Caret to show already on mouse over.