Reputation: 464
I have a textbox on a Grid. I populate this textbox with some text and when losing focus (I click outside this component containing the Grid with the textbox), I still have the text cursor visible. Its not blinking but is visible. Isn't WPF supposed to take care of this?
The marker is not blinking in this state, its just showing a |.
I have no idea how to approach this, any suggestions?
Upvotes: 2
Views: 4423
Reputation: 51
"Since the caret is shown, but not blinking, then I am guessing your control has Logical Focus, but not Keyboard Focus."
I believe this post TextBox Cursor is NOT blinking will explain your answer.
Upvotes: 1
Reputation: 2117
For posterity sake I wanted to point out that this can be done once in the xaml for the Grid instead of every time focus changes for the TextBox.
<Grid FocusManager.IsFocusScope="True">
<TextBox />
</Grid>
Upvotes: 4
Reputation: 464
Solved with adding this to the focus event for the textbox.
FocusManager.SetIsFocusScope(this, true);
Upvotes: 3