0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I think I may have explained poorly. I need to run a sql query which takes three parameters... customerID, part #, manufacturerID. The results of this query would be the items source of each combobox. CustomerID will be the same across all items, but part # and Manufacturer will be different for each part in the datagrid.
I don't follow your idea about adding datarows to the object and then binding the itemssource to it. Could you show some quick XAML to illustrate? My problem is that I need some parameters to come from the object in the datagrid, and others to come from elsewhere on the window.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.