Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
755
ThemeManager Theme throws System.NotSupportedException
posted

Hi all

When I try to bind WPF application with

<ig:ThemeManager.Theme>
        <ig:Office2013Theme StyleMicrosoftControls="True" />
</ig:ThemeManager.Theme>

I've got the exception(look at attached pic). The main xaml looks like

<Window x:Class="Backup.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ignore="http://www.ignore.com"
        xmlns:ig="http://schemas.infragistics.com/xaml"
        mc:Ignorable="d ignore"
        Height="300"
        Width="300"
        Title="Backup V1.0"
        WindowStartupLocation="CenterScreen"
        ResizeMode="NoResize"
        WindowStyle="None"
        DataContext="{Binding Main, Source={StaticResource Locator}}">
    
    <Window.Resources>
    </Window.Resources>
    
    <ig:ThemeManager.Theme>
        <ig:Office2013Theme StyleMicrosoftControls="True" />
    </ig:ThemeManager.Theme>

    <Grid x:Name="LayoutRoot">

        <Button Content="Terst" Height="30" Width="30"></Button>
    </Grid>
</Window>

What am I doing wrong?

THanks

  • 430
    posted

    I am also getting exceptions when using the ThemeManager.

    As soon as I add

    <ig:ThemeManager.Theme>
            <ig:IgTheme />
    </ig:ThemeManager.Theme>

    to my XAML, they start popping up and its kinda annoying.

    A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
    A first chance exception of type 'System.NotSupportedException' occurred in PresentationFramework.dll
    [repeated many times]

    System.Xaml.XamlObjectWriterException occurred
      _HResult=-2146233088
      _message=Failed to create a 'DependencyProperty' from the text 'Background'.
      HResult=-2146233088
      IsTransient=false
      Message=Failed to create a 'DependencyProperty' from the text 'Background'.
      Source=System.Xaml
      LineNumber=0
      LinePosition=0
      StackTrace:
           at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo)
      InnerException: System.NotSupportedException
           _HResult=-2146233067
           _message=Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'.
           HResult=-2146233067
           IsTransient=false
           Message=Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'.
           Source=PresentationFramework
           StackTrace:
                at System.Windows.Markup.DependencyPropertyConverter.ResolveProperty(IServiceProvider serviceProvider, String targetName, Object source)
                at System.Windows.Markup.DependencyPropertyConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object source)
                at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value)
                at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value, XamlMember property)
                at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo)
           InnerException:

    I configured the debugger to stop on XamlObjectWriterException so I could see why. The first exception seems to be related to something that has Background setter but there is no background dependency property on that type. No details are given as to what exactly is causing the error. Moving onto the next few occurrences and we see other things like BorderBrush and BorderThickness pop up as being setters on something that has no corresponding dependency property. Seems to me like something fishy is going on inside that DLL that needs to be looked at

    In order to eliminate the exceptions, I tried manually adding add of the resource references from the IG theme into my shared styles dictionary. Once I do this and remove the XAML above, the exceptions stop!  Ok, something is up.

        <ResourceDictionary.MergedDictionaries>

            <!-- Here we shall include any IG theme items. -->
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.DataVisualization.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.MSControls.Core.Implicit.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.OlapCharts.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.WPF.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamBarcode.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamCalendar.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamColorPicker.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamComboEditor.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDataChart.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDataPresenter.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDataTree.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDateTimeInput.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDiagram.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDialogWindow.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamDockManager.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamEditors.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamFormulaEditor.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamGantt.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamGauge.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamGeographicMap.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamGrid.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamMap.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamMaskedInput.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamMenu.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamMultiColumnCombo.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamNetworkNode.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamOrgChart.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamOutlookBar.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamPivotDataSlicer.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamPivotGrid.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamPropertyGrid.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamRadialMenu.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamRibbon.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamRichTextEditor.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamSchedule.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamSlider.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamSparkline.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamSpellChecker.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamSpreadsheet.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamSyntaxEditor.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamTagCloud.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamTileManager.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamTimeline.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/IG.xamTreemap.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/Styles.Shared.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/Styles.WPF.xaml" />
            <ResourceDictionary Source="/MyProject;component/Themes/IG/Theme.Colors.xaml" />

        </ResourceDictionary.MergedDictionaries>

    Infragistics, please look into this further as I don't think the exceptions should be getting thrown, so something is amiss. I don't get any exceptions when manually including the theme resources. On an odd but seemingly related note, I know I couldn't include IG.xamGauges.xaml because it couldn't find certain resources despite having included all of the IG dlls in my project. I don't use it so it doesn't matter much to me right now, but I think its worth mentioning.

    As a workaround, try manually including all of the theme resources like I did.

  • 755
    Offline posted in reply to Konstantin Koynov

    When I execute the wpf application on other machine instead of mine, then I've got the following .net runtime error:

    roblemsignatur:
      Problemereignisname:    CLR20r3
      Problemsignatur 01:    dump.exe
      Problemsignatur 02:    0.0.0.1
      Problemsignatur 03:    55af5a1e
      Problemsignatur 04:    mscorlib
      Problemsignatur 05:    4.0.0.0
      Problemsignatur 06:    4ee9af8e
      Problemsignatur 07:    2603
      Problemsignatur 08:    0
      Problemsignatur 09:    System.Windows.Markup.XamlParse
      Betriebsystemversion:    6.1.7601.2.1.0.256.4
      Gebietsschema-ID:    2055
      Zusatzinformation 1:    0a9e
      Zusatzinformation 2:    0a9e372d3b4ad19135b953a78882e789
      Zusatzinformation 3:    0a9e
      Zusatzinformation 4:    0a9e372d3b4ad19135b953a78882e789

    Lesen Sie unsere Datenschutzbestimmungen online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0407

    Wenn die Onlinedatenschutzbestimmungen nicht verfügbar sind, lesen Sie unsere Datenschutzbestimmungen offline:
      C:\Windows\system32\de-DE\erofflps.txt

  • 6759
    Offline posted

    Hi Jean-Pascal Robert-Nicoud,

    Could you please post the full exception details(Click "Copy exception detail to the clipboard" link on the exception popup in VS and paste it into a text file - check out the attached screenshot) so I could have a better chance to get some idea what's is going on. It would be even better if you could create a small sample that illustrate the exception you're getting.