首页 新闻 会员 周边

请问WindowsPhone中页面可以不直接继承Page类么

0
悬赏园豆:5 [已关闭问题] 关闭于 2015-07-29 16:49

我写了一个类(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>
Sago的主页 Sago | 初学一级 | 园豆:48
提问于:2015-04-21 21:52
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册