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

Parents
  • 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.

Reply Children
No Data