Problem using MEF for Themes

2 posts, 0 answers
  1. Des
    Des avatar
    1 posts
    Member since:
    Jun 2010

    Posted 16 Jun 2011 Link to this post

    I have seen an old post from last year of someone else trying to do something similar so I am hoping there may be an update...  Basically, I would like to be able to only download the theme when I need it and I intend to use MEF to accomplish this.  I have created a Silverlight App (therefore generates a theme.xap) which references:
    - one of the Telerk Themes projects eg. Expression_Dark
     - Telerik.Windows.COntrols.dll

    All goes well until I call StyleManager.ApplicationTheme = newTheme

    Stack trace of error below seems to imply that something is looking for the controlAssembly - Which  controlAssembly?  (I know and can also prove that Telerik.Windows.Controls is loaded.)

      at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, String s)
       at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
       at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
       at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
       at System.Windows.ResourceDictionary.set_Source(Uri value)
       at Telerik.Windows.Controls.Theme.CreateResourceDictionaryForApplicationTheme(Theme theme, String controlAssembly)
       at Telerik.Windows.Controls.StyleManager.OnApplicationThemeChanged(Theme oldValue, Theme newValue)
       at Telerik.Windows.Controls.StyleManager.set_ApplicationTheme(Theme value)
       at MyCompany.MyProject.Shell.Shell.SetTheme(IMyProjectTheme theNewTheme, Exception e)

    I know my theme xap is loaded as I have executed some other temporary code inside it to prove this point.  I have also tried deriving from Theme and making a generic.xaml that Merges all other bits from the Telerik own Expression_Dark project but also to no avail.

    I think all is well in my theme XAP and with my logic because if the root silverlight application has an assembly reference to the Expression_Dark dll itself then all works ok it is only when I rely on this dll being delivered by the theme xap that it all falls apart.

    Any help would be much appreciated

    Regards, Des
  2. Pana
    Pana avatar
    748 posts

    Posted 24 Jun 2011 Link to this post

    Hello Des,

    We will try to create a basic example that uses telerik themes loaded on demand using MEF but currently we have no available resources so it will take some time. I am really sorry for the inconvenience. In general you could check how the themes are loaded in the code of the QSF (the demo site) - that is if you have an account and access to it and see how the themes are loaded there.

    Best wishes,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top