Set focus on TextBox in WPF from view model

后端 未结 21 2232
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 06:21

I have a TextBox and a Button in my view.

Now I am checking a condition upon button click and if the condition turns out to be false, displ

21条回答
  •  有刺的猬
    2020-11-22 06:52

    The problem is that once the IsUserNameFocused is set to true, it will never be false. This solves it by handling the GotFocus and LostFocus for the FrameworkElement.

    I was having trouble with the source code formatting so here is a link

提交回复
热议问题