Problem binding DataGridComboBoxColumn.ItemsSource

后端 未结 2 1245
遇见更好的自我
遇见更好的自我 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:32

    The columns in the datagrid don't have a datacontext, as they are never added to the visual tree. sound a bit weird but have a look at vince's blog, its got a good example of the visual layout. once the grid is drawn the cells have a data context and you can set the combo boxes items source in them using normal bindings (not static resources..)

    You can access the combo box items source as such:

    
       
          
       
    
    

    Have a look here and also here for some code. You will also need to set the items source for the non edting element as in this post

提交回复
热议问题