Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my app.xaml:

HTML
<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>


there isn't a Theme.cs
this is my Theme.xaml:
HTML
<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 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)


if full stack is required just ask.

what is the problem?

Thanks,
Gabriel Sas
Posted

1 solution

Dont know if this would be the answer but I did this:
XML
<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/AppStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>



Here;
WPF-Drawing Canvas Control[^]
 
Share this answer
 
Comments
Gabriel Sas 27-Apr-13 15:59pm    
this isn't the answer. the error still appears
Kenneth Haugland 27-Apr-13 16:02pm    
does it work without the expression blend stuff? Are you missing a dll file etc? What I did worked in my application so I guess its something else then :-)
Kenneth Haugland 27-Apr-13 17:05pm    
At a little closer look it seems that you might have styled something wrong, using 'System.Windows.Media.Color' instead of 'System.Windows.Media.Brush'
Gabriel Sas 27-Apr-13 17:10pm    
it works if Theme.xaml is empty, or simple stuff, the Theme.xaml is from codeplex, i don't know what is in there, and i didn't found something using media.color in my application
Kenneth Haugland 27-Apr-13 17:15pm    
Its hard to say what it is without seeing the full code, however it can be something to do with the llinear gradien brush, so that it depends on what you have used it on etc...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900