我的演示者定义了自己的观点:
public SmartFormPresenter(SmartFormView view)
{
View = view;
View.DataContext = this;
}
在视图中,我有一个带有 x:Name="MainTabControl"的元素:
<DockPanel LastChildFill="True">
<TabControl x:Name="MainTabControl" DockPanel.Dock="Top" ItemsSource="{Binding SmartFormAreaPresenters}">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Header" Value="{Binding Title}"/>
</Style>...
如何像在后面的代码中那样访问此元素,如下所示:
PSEUDO-CODE:
View.Root.Children.MainTabControl.Visibility = Visibility.Collapsed;