Set ListBoxItem.IsSelected when child TextBox is Focused

前端 未结 5 994
难免孤独
难免孤独 2020-12-14 11:48

I have a typical MVVM scenario: I have a ListBox that is binded to a List of StepsViewModels. I define a DataTemplate so that StepViewModels are rendered as StepViews. The

5条回答
  •  余生分开走
    2020-12-14 12:09

    Edit: Someone else already had the same answer on a different question: https://stackoverflow.com/a/7555852/2484737

    Continuing on Maexs' answer, using an EventTrigger instead of an EventSetter removes the need for code-behind:

    
        
            
                
                    
                        
                    
                
            
        
    
    

提交回复
热议问题