我正在用MvvmCross编写WPF应用程序。我希望能够在视图中具有内容框架架构,以便在停留在同一页面上时可以显示不同的视图。像这样:
<views:MvxWpfView
x:Class="MyApp.WPF.Views.HomeView"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.Row=1 Content="This label will always be shown"/>
<!-- I want to inject the associated View when I navigate to its ViewModel -->
<views:MvxWpfView Grid.Row=2/>
</Grid>
</views:MvxWpfView>
然后当我打电话给类似的东西
await NavigationService.Navigate<SubViewModel>();
它将关联的SubView
加载到内部MvxWpfView
中,我仍然会在顶部看到标签。我已经在Android中处理过片段,并且正尝试与之保持一致。