WPF - example with DataGridComboBoxColumn

前端 未结 2 886
慢半拍i
慢半拍i 2021-02-19 10:18

I have a datagrid with 2 columns. One column contains role information, the other column should have a combo box with a list of available users. The data in the combobox is unre

2条回答
  •  我寻月下人不归
    2021-02-19 10:33

    Instead of using DataGridTextColumn one uses a DataGridComboBoxColumn instead. Then one fills in the data using the ItemsSource, which in the below example points to an external enum in the static resource, and finally one binds the result to the target object which will hold the user selection in the SelectedItemBinding.

    
    
    
    
    

    See a full example on MSDN at DataGridComboBoxColumn Class

提交回复
热议问题