Wpf 如何在我的视图代码中访问数据模板中的网格

Wpf 如何在我的视图代码中访问数据模板中的网格,wpf,Wpf,我有一些像这样的XAML <Grid Name="LayoutRoot"> <TabControl ItemsSource="{Binding Path=Plugins}" DisplayMemberPath="Name" SelectedIndex="{Binding Path=CurrentProductIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

我有一些像这样的XAML

<Grid Name="LayoutRoot">
    <TabControl ItemsSource="{Binding Path=Plugins}" DisplayMemberPath="Name" 
                SelectedIndex="{Binding Path=CurrentProductIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                >

        <TabControl.ContentTemplate>
            <DataTemplate>
                <Grid Name="PluginRegion">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>


                </Grid>

            </DataTemplate>
        </TabControl.ContentTemplate>

    </TabControl>
</Grid>
我需要在我的过程代码中访问名为PluginRegion的网格。目标是在运行时将子项添加到此网格。
由于没有创建成员,如何访问此网格

这不是它的工作原理。您将项目添加到案例中的ItemsSource插件集合中,DataTemplate定义了该项目的显示方式。所以我想我的问题是如何定义一个选项卡控件,在这里我可以通过编程向选项卡控件添加内容,并让模板知道如何显示它,或者更确切地说,如何将集合中的某些内容绑定到网格中的行。我可能问得非常错误:-多研究一下WPF中的模板,你就会自己找到答案。我想不出哪种情况下访问模板内部的控件是一个好的解决方案。