I have a DataGrid with a combobox inside a template column. Elsewhere on this screen, the user makes a 'customer' selection from a separate control altogether. In order to populate the comboboxes in my datagrid, I need to pass in that selected customer as a parameter, in addition to other information from each row in the grid.
Basically... the grid contains part information, and the combobox items are based 开发者_运维技巧on a combination of the following: selected customer, part number, and manufacturer. Each row's combobox can potentially have a different source list. Is there a way I can bind the ItemsSource for that combobox in XAML?
I may not understand correctly, but you could possibly have an object that contains all that information together, and bind that to the combo box.
ie
public class ContextualInfo
{
public Customer Customer { get; set; }
public int PartNumber { get; set; }
public Manufacturer Manufacturer { get; set; }
}
In reply to comment.
How about having the rows returned from the query to also be in the ContextualInfo mentioned above? You can then bind the itemsource to that. You could potentially run the query in the constructor for the ContextualInfo class.
精彩评论