所以我使用的是MVVM,由于某种原因,当我创建一个带标签的主页时,并添加将成为内容页面的子级,在切换槽标签时,它们不会显示任何内容任何。我需要某种InotifyPropertyChanged吗?因为我不认为视图模型知道我在使用它。
这是我的标签页xaml:
<?xml version="1.0" encoding="utf-8" ?>
<d:MvxTabbedPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:d="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:local="clr-namespace:Test.Core.Pages"
xmlns:mvx="clr-namespace:MvvmCross.Forms.Bindings;assembly=MvvmCross.Forms"
xmlns:viewModels="clr-namespace:Test.Core.ViewModels;assembly=Test.Core"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:TypeArguments="viewModels:MainPageViewModel"
x:Class="Test.Core.Pages.MainPage">
<local:BudgetPage Title="Budget" Icon=""/>
<local:DeliveryPage Title="Delivery" Icon=""/>
</d:MvxTabbedPage>
这是xaml(预算)的内容页面之一:
<?xml version="1.0" encoding="utf-8" ?>
<d:MvxContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:d="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:local="clr-namespace:Test.Core.Pages"
xmlns:mvx="clr-namespace:MvvmCross.Forms.Bindings;assembly=MvvmCross.Forms"
xmlns:viewModels="clr-namespace:Test.Core.ViewModels;assembly=Test.Core"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:TypeArguments="viewModels:BudgetViewModel"
x:Class="Test.Core.Pages.BudgetPage">
<ContentPage.Content>
<ScrollView Orientation="Vertical">
<StackLayout HorizontalOptions="FillAndExpand">
<!--FEES
-->
<Label FontSize="Medium" Text="Fees"/>
<Frame><Label mvx:Bi.nd="Text Gross"/></Frame>
<Frame><Label mvx:Bi.nd="Text Realization"/></Frame>
<Frame><Label mvx:Bi.nd="Text Net"/></Frame>
<Frame><Label mvx:Bi.nd="Text TotalHours"/></Frame>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</d:MvxContentPage>
致谢
答案 0 :(得分:0)
您缺少Children
属性,似乎您继承了TabbedPage来创建自定义标签页。
您的代码应如下所示。
<?xml version="1.0" encoding="utf-8" ?>
<d:MvxTabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Test.Core.Pages"
x:Class="App.MvxTabbedPage">
<MvxTabbedPage.Children>
<local:BudgetPage Title="Budget" Icon=""/>
<local:DeliveryPage Title="Delivery" Icon=""/>
</MvxTabbedPage.Children>
</d:MvxTabbedPage >