Select ListBoxItem if TextBox in ItemTemplate gets focus

后端 未结 3 1018
情深已故
情深已故 2020-11-30 12:56

I have added a DataTemplate to a ListBox class to bind my collection to:



        
3条回答
  •  失恋的感觉
    2020-11-30 13:28

    If you have multiple instance of ListBox then you may consider using your custom listbox (by deriving it from ListBox). See the explanation here.


    Or, use this hack if you have only 1 (or only small number of) such ListBox and don't want to create a separate class for that:

    
    
        
            
        
    
    
    

    Note that you'll have to click once again to edit text in the TextBox (which is actually cool according to me).

提交回复
热议问题