ListBoxItem produces “System.Windows.Data Error: 4” binding error

前端 未结 3 1047
粉色の甜心
粉色の甜心 2020-12-14 01:14

I have created the fallowing ListBox:



        
3条回答
  •  感情败类
    2020-12-14 02:01

    The easiest way to solve this is to ensure that your Listbox has a ItemContainerStyle. See the following example:

    
        
            
        
    
    ...
    
    
    

    What happens is that your Items are being created, and by default they look for parent's property which isn't defined. Explicitly defining it will solve this problem.

    I had the same issue using a TreeView and changing the bound source for these templates would cause those warnings.

提交回复
热议问题