无法设置PhoneApplicationPage的模板

时间:2012-10-13 22:16:57

标签: c# windows-phone-7 templates windows-phone

我想设置PhoneApplicationPage的模板。当我尝试这段代码时:

<phone:PhoneApplicationPage.Template>
    <ControlTemplate>
        <Grid>
            <ContentPresenter/>
        </Grid>
    </ControlTemplate>
</phone:PhoneApplicationPage.Template>

我收到此“xaml”错误:

4011 An error has occurred.

但是当我尝试这个时:

<phone:PhoneApplicationPage.Style>
    <Style TargetType="mpc:PhoneApplicationPage">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid>
                        <TextBlock Text="Test"/>
                        <ContentPresenter/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>                
    </Style>
</phone:PhoneApplicationPage.Style>

我没有任何错误,但没有任何反应。

我想知道为什么我不能将自己的模板设置为PhoneApplicationPage。

感谢答案。

注意:我有BaseFormPage,它应该使用这个模板,其他派生页面的内容会有所不同,但模板将是相同的,派生自BaseFormPage。

0 个答案:

没有答案