tags:

views:

76

answers:

1

I have a TabControl with TabPage1 and TabPage2, In TabPage1, there is another TabControl1 with 2 Items TabPage11 and TabPage12.
In TabPage2, there is another TabControl2 with 2 Items TabPage21 and TabPage22.

Each item (TabPage11 , TabPage12, TabPage21 and TabPage22) has its own View (in form of UserControl) and ViewModel. there is dataGrid on each View.

Now I want to implement ExportToExcel function for each dataGrid. I can put a ExportToExcel Button on each tabItem, but it does not look good. So I put one button on main window so when user clicks the button, the dataGrid on selected tabItem get processed.

The problem is that the button on the mainWindow does't know how to tell the
ViewModel of selected tabItem to export it.

Any Suggestions? Thanks in advance! Steve

A: 

The main function should collate information from the controller(s) of the tabs, and they should collate information from their sub tab controllers if I understand you right, which will extract info from the right view model.

Preet Sangha