向应用程序添加wpf主题时出错 [英] error when adding a wpf theme to application
本文介绍了向应用程序添加wpf主题时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的app.xaml:
this is my app.xaml:
<Application x:Class="Hearts.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary Source="Theme.xaml"/>
</Application.Resources>
</Application>
有没有Theme.cs
这是我的Theme.xaml:
there isn''t a Theme.cs
this is my Theme.xaml:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
<!--SHINY BLUE SETTINGS FOR CHARTS-->
<LinearGradientBrush x:Key="ShinyChartOrange" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFDDBAE" Offset="0" />
<GradientStop Color="#FFCE955A" Offset="0.185" />
<GradientStop Color="#FFAB7547" Offset="0.475" />
<!-- Long code here i got from look at link -->
</ResourceDictionary >
codeplex wpf主题
现在我有这个错误:
codeplex wpf themes
and now i have this error:
System.Reflection.TargetInvocationException
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
System.InvalidCastException
Unable to cast object of type 'System.Windows.Media.Color' to type 'System.Windows.Media.Brush'.
at MS.Internal.Text.TextProperties.InitCommon(DependencyObject target)
at MS.Internal.Text.TextProperties..ctor(FrameworkElement target, Boolean isTypographyDefaultValue)
at System.Windows.Controls.TextBlock.GetLineProperties()
at System.Windows.Controls.TextBlock.EnsureTextBlockCache()
at System.Windows.Controls.TextBlock.MeasureOverride(Size constraint)
如果需要满满一堆请问。
有什么问题?
谢谢,
Gabriel Sas
if full stack is required just ask.
what is the problem?
Thanks,
Gabriel Sas
推荐答案
不知道这是不是答案,但我这样做了:
Dont know if this would be the answer but I did this:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/AppStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
这篇关于向应用程序添加wpf主题时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文