WP7 Mango: Retemplating PhoneApplicationFrame created “Unspecified Error” exception

时光总嘲笑我的痴心妄想 提交于 2019-12-10 17:50:50

问题


The following used to work in WP 7.0:

I'm attempting to re-template the root PhoneApplicationFrame in my Mango beta 2 refresh (7712) project with the following Xaml:

<Style TargetType="phone:PhoneApplicationFrame" x:Key="FrameStyle">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                <Border x:Name="ClientArea" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" >
                    <Grid>
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
                        <toolkit:PerformanceProgressBar IsIndeterminate="True" VerticalAlignment="Top" Margin="0,8,0,0" Visibility="{Binding Path=GlobalProgressVisibility, Source={StaticResource RootFrameViewModel}}" />
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

When the application launches I get an App.UnhandledException with the text "Unspecified error" and no stack trace. Has anyone seen this?


回答1:


Blend was helpful in pointing out some properties that shouldn't be set in Mango. Removing the Content and ContentTemplate properties fixed the issue.




回答2:


I can't reproduce exactly your problem, but I had the same error retemplating a listbox. Try setting the TargetType property on the ControlTemplate (worked for me) :

<ControlTemplate TargetType="phone:PhoneApplicationFrame">


来源:https://stackoverflow.com/questions/7132232/wp7-mango-retemplating-phoneapplicationframe-created-unspecified-error-except

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!