How should I access multiple ItemsSources from filtered collections when the objects get unwieldy?
I have the equivalent of a clothing store. I put in standing orders for clothes to be delivered each month, but some things can be flexible each month - for instance, I know that I am more likely to sell black clothes during the winter and tighter sizes during the summer.
There are some elements of the order which don't change, and some which do. I have the overall order in a panel and the changeable items displayed in tabs by month. Some of the ItemsSources within the ComboBoxes for each month depend on values for the order; some depend on values for that month.
For reasons of performance and because the classes are getting large and unwieldy I really want to be able to get two different DataContexts for each month as follows, but obviously I can't:
---------------------------------------------------------------
| Order |
| OrderItemsSources |
|-------------------------------------------------------------|
| | |
|MonthlyOrder[0] | MonthlyOrder[1] | etc.
|MonthItemsSources[0] | MonthItemsSources[1] | etc.
| | |
-------------------------------------------------------------
Those are tabs at the bottom; only one is visible at a time. Each tab contains about 20 fields drawn from the MonthlyOrder with its ItemsSources as potential values.
At the moment I can only access those MonthItemsSources through the actual MonthlyOrder. My MonthlyOrderViewModel wraps both the MonthlyOrder and the MonthItemsSources, which are the possible value开发者_运维知识库s to which the MonthlyOrder's fields can be set, given the other choices of fields already made.
---------------------------------------------------------------
| Order |
| OrderItemsSources |
|-------------------------------------------------------------|
| | |
|MonthlyVM.Order[0] | MonthlyVM.Order[1] | etc
|MonthlyVM.ItemsSources[0] | MonthlyVM.ItemsSources[1] | etc.
| | |
-------------------------------------------------------------
Is there any way to do separate the MonthlyOrder from its ItemsSources? Any way to pass an index into a binding, or a reference of some kind, so that I can get the tabs into the form at the top?
精彩评论