Problem binding DataGridComboBoxColumn.ItemsSource

后端 未结 2 1244
遇见更好的自我
遇见更好的自我 2020-12-01 15:15

I have 3 tables: Item - which is the DataContext - it has a navigation column Group Group - has a navigation column Category.

I want to have in the DataGrid both (Ca

2条回答
  •  有刺的猬
    2020-12-01 15:46

    I was using MVVM and I wanted to bind the ItemSource of the column to a collection of objects in the window data context. I must have tried 10 different ways and nothing worked until I found this answer.

    The trick is to define a CollectionViewSource outside the grid and then reference it inside the grid using StaticResource. For example,

    
        
    
    
    
        
    
    

提交回复
热议问题