Set focus on TextBox in WPF from view model

后端 未结 21 2266
爱一瞬间的悲伤
爱一瞬间的悲伤 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:46

    An alternative approach based on @Sheridan answer here

     
            
                
            
        
    

    In your view model set up your binding in the usual way and then set the SomeTextIsFocused to true to set the focus on your text box

提交回复
热议问题