Iterate over tabcontrol in wpf

85 views Asked by At

I'm developing WPF app. The problem is:

  1. I have TabControl

  2. Inside of each TabControl I have DataGridView

  3. I need to print content of each DataGridView from TabControl in one document

  4. I can't use lists from ViewModels because I need to take under consideration if columns of DataGridView are visible or not

  5. I'm able to print one particular DataGrid

How to iterate over TabControl to get access to DataGridViews? Thank you for your help!

Part of view with tab control:

<UserControl>
<UserControl.Resources>
    <DataTemplate DataType="{x:Type local:EmployeeAuthorizationListViewModel}">
        <views:EmployeeAuthorizationsListView/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type local:EmployeeTrainingListViewModel}">
        <views:EmployeeTraningsListView/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type local:EmployeeMachineListViewModel}">
        <views:EmployeeMachineListView/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type local:EmployeeInspectionListViewModel}">
        <views:EmployeeInspectionListView/>
    </DataTemplate>
</UserControl.Resources>
<Grid>
                <TabControl Grid.Column="1" ItemsSource="{Binding Tabs}" SelectedItem="{Binding ActiveTab}">
                    <TabControl.ItemTemplate>
                        <DataTemplate>
                            <HeaderedContentControl Header="{Binding ViewTitle}" />
                        </DataTemplate>
                    </TabControl.ItemTemplate>
                </TabControl>
            </Grid>
</UserControl>
0

There are 0 answers