使项目适应Template10,我进入 App.xaml 中的继承样式正在崩溃。
它看起来像Template10,不支持继承或扩展样式。我试图从TitleStyle扩展SubTitleStyle ,但在XamlTypeInfo.g.cs中的GetXamlType上出现 COM 异常
我的 App.xaml.cs
sealed partial class App : BootStrapper
{
public App() { InitializeComponent(); }
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
NavigationService.Navigate(typeof(ShellView))
await Task.CompletedTask;
}
}
我的应用程序.xaml
<Style x:Key="TitleStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextTitleForeground}"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="FontWeight" Value="Medium"/>
</Style>
<Style x:Key="SubTitleStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}">
<Setter Property="Foreground" Value="{StaticResource TextForeground}"/>
<Setter Property="FontSize" Value="20"/>
</Style>
异常信息:
Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.WindowsRuntime.IIterator`1.MoveNext()
at System.Runtime.InteropServices.WindowsRuntime.IteratorToEnumeratorAdapter`1.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Template10.Common.BootStrapper.<InitializeFrameAsync>d__77.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Template10.Common.BootStrapper.<InternalLaunchAsync>d__53.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()