简体   繁体   中英

Manually add to combobox in Datagrid using c# wpf

I find the following problem a little bit tricky, and need your help on the matter.

I have a popupbox, containing a datagrid. This datagrid consists of 3 columns, one of those is a combobox.

The datagrids itemssource is bound to a property, which I want to use to extract information entered in the datagrid.

The problem is, that the combobox in the datagrid should be populated dynamically, and preferably not using a binding. So I want to add elements to the combobox using C# in the code-behind.

How can I add items to a combobox, that is part of a datagrid, using c#?

I solved the problem myself. Assigning the databinding/itemssource from code did the trick. I had totally forgotten about this option when I wrote the question. Thanks anyway!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM