<Grid x:Name="NewDeploymentObjectPanel"
Background="White"
DataContext="{Binding Detail}">
<Grid Grid.Row="13" DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=UserControl}}">//重新绑回,UserControl是父控件
.....
</Grid>
</Grid>
如下是treeitem的数据源重新绑定到treeview上
<TreeView.ItemContainerStyle>
<Style BasedOn="{StaticResource Comprehensive.TreeViewItemStyle}" TargetType="{x:Type TreeViewItem}">
<Style.Resources>
<ContextMenu x:Key="cm" DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=TreeView}}">