我写了一个类(PageBase)继承自Page类。然后让所有的页面继承自PageBse。结果编译报错。
public abstract class PageBase<T> : Page, IBuildViewModel<T> where T : new() { protected T ViewModel { get; set; } public abstract T BuildViewModel(); }
Error 1 Partial declarations of 'GeekSchool.MainPage' must not specify different base classes D:\Work Space\Sago.VisualStudio.com\Windows Phone\GeekSchool\GeekSchool\GeekSchool\MainPage.xaml.cs 25 30 GeekSchool
我不知道对应前台的XAML怎么定义才可以。
<Page x:Class="GeekSchool.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:GeekSchool" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="1*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition> </Grid.RowDefinitions> <FlipView> <FlipView.ItemTemplate> <DataTemplate> <Grid> <Image Width="480" Height="270" Source="{Binding Image}" Stretch="UniformToFill"/> <Border Background="#A5000000" Height="80" VerticalAlignment="Bottom"> <TextBlock Text="{Binding Name}" FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/> </Border> </Grid> </DataTemplate> </FlipView.ItemTemplate> </FlipView> </Grid> </Page>