问题
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