This is a migrated thread and some comments may be shown as answers.

Theming don't work properly

9 Answers 651 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Martin Horst
Top achievements
Rank 1
Martin Horst asked on 09 Jun 2010, 08:23 AM

Hi,

after switching to the SP2 (2010.1.10.504) I have a lot problems using themes. When I add the Office black theme and start my application I get two errors that resources are missing (TabOffice12Shape and another one). When I add the Office 10 theme and start the application I get a System.ArgumentException "Specified resource does not exist.". This only happens when I start the application without debugging. If I use the debugger, it works fine. So I think there is a major timing problem when themes are loaded. My I solution is now to remove the Telerik controls and switch back to normal Windows Forms controls. 

Martin

9 Answers, 1 is accepted

Sort by
0
Martin Horst
Top achievements
Rank 1
answered on 09 Jun 2010, 10:04 AM

Hi,

there seem to be problem with the resource loader. The ThemeResolutionService uses the calling and the executing assembly to find the corresponding resource stream. The calling resource is normally the right one but don't work in my application without debugging. In the MSDN I found that the calling assembly could change if the calling methode is inlined or jitted. Therefore I tried load the theme resource by my own:

        Assembly lAssembly = Assembly.GetAssembly(typeof(Telerik.WinControls.Themes.Office2010Theme));  
        Telerik.WinControls.ThemeResolutionService.LoadPackageResource(lAssembly, "Telerik.WinControls.Themes.Office2010.tssp");  
 

If I do so, the theme is loaded but then I get the rror message that the TabIeShape resource could not be found. 

I'm using VS2010 and the .net 4.0 framework. I know that there a a lot of changes which may be the cause for this problem.

Regards

Marttin

0
Nikolay
Telerik team
answered on 09 Jun 2010, 12:10 PM
Hi Martin Horst,

The issue regarding shapes comes from the fact that when you drop an Office2007Black component on your form, only Telerik.WinControls and Telerik.WinControls.Themes.Office2007Black assemblies are loaded in the project. However, the shapes are contained in Telerik.WinControls.UI assembly, so as a result you get a message that they can't be found. You can either drop a single RadButton instance on your form in order to get a reference to Telerik.WinControls.UI assembly, or you can add a reference to Telerik.WinControls.UI assembly manually. This issue will be addressed in Q2 2010.
 
As to the second issue concerning the Office2010 theme, you are absolutely right. Thank you for your feedback and cooperation on the issue. Your Telerik points have been updated for it. You can avoid the missing shape message by creating a new instance of the shape. Please note that the Telerik.WinControls.UI assembly should be referenced:
new Telerik.WinControls.UI.TabIEShape();
  
Assembly lAssembly = Assembly.GetAssembly(typeof(Telerik.WinControls.Themes.Office2010Theme));
Telerik.WinControls.ThemeResolutionService.LoadPackageResource(lAssembly, "Telerik.WinControls.Themes.Office2010.tssp");

I hope this helps. If you have additional questions, feel free to contact me.

Regards,
Nikolay
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.
0
Martin Horst
Top achievements
Rank 1
answered on 09 Jun 2010, 12:49 PM

Hi,

thanks for your answer. Adding the new Telerik.WinControls.UI.TabIEShape(); solved the problem. I already tried this but I think I used the wrong class (something like TabIE7Shape). Now everything works fine.

Best regards

Martin

0
Chris Kirkman
Top achievements
Rank 1
answered on 16 Nov 2010, 03:54 PM
where are you placing this code?

we also had this issue on Windows 7 64-bit machines; however we've moved on to the Office 2010 theme and I'm not certain it even exists as an issue at this point.  We're also using the 2010.2.10.806 build.
0
Stefan
Telerik team
answered on 19 Nov 2010, 09:45 AM
Hi Chris Kirkman,

Thank you for writing.

This code can be placed in form's constructor and it should work fine.  
However, I am not sure that I understand correctly, are you experiencing an issue. If this is the case please provide a detailed description and send us your project. We will be glad to help further.

I am looking forward to your reply.

Sincerely yours,
Stefan
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
0
Eric
Top achievements
Rank 1
answered on 02 Feb 2012, 01:42 AM
Just a note to let you know this is still a problem today.  In my scenario I have an embedded Theme file.  I initialize this once per application.  It only happens when calling this method from another assembly.  

So for discussion sake, I've got assembly A that calls into assembly B to initialize the theme. Assembly B contains the embedded resource theme file.  If I call this method (below) directly from within assembly B I will not need the OfficeShape object.  However, if I call it via assembly A I will.

info:
 Telerik 2011.3.11.1219
 .Net 3.5

Public Shared Sub InitTelerik()
 
       If m_telerikInitialized Then Return
 
       Try
           'The following will avoid the above Telerik bug.
           Dim telerikPleaseHelpLoadTheTheme As New Telerik.WinControls.UI.OfficeShape()
 
           'Set the Telerik style theme at the application level
           Telerik.WinControls.ThemeResolutionService.LoadPackageResource(cst_TelerikApplicationThemeResource)
           Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = cst_TelerikApplicationThemeName
 
           m_telerikInitialized = True
       Catch ex As Exception
           LogWriter(ex)
       End Try
   End Sub
0
Stefan
Telerik team
answered on 06 Feb 2012, 12:38 PM
Hello Eric,

Thank you for writing.

The issue that was reported in this thread and resolved in Q2 2010 was an error message that appeared when you drop a theme component from our Toolbox to the form. The issue was caused by the fact that the theme contains shapes which are located in the Telerik.WinControls.UI assembly and this assembly was not automatically loaded when a theme component was dropped to the form. However, this now works fine and the UI assembly is loaded correctly.

Now to your case. The observed behavior is the expected behavior, because when you call this method from within project B (with the embedded theme), the UI assembly with the shapes in it is loaded, so such a call it not needed. However, when you call this method from project A, the assembly is not loaded and creating the office shape instance is needed since it will make the UI assembly load. 

Attached you can find a sample project which demonstrates the easiest approach for this scenario.

Let me know if you have additional questions.

Kind regards,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Eric
Top achievements
Rank 1
answered on 06 Feb 2012, 04:58 PM
Still sounds like a bug. Seems to me the assembly performing the
Telerik.WinControls.ThemeResolutionService.LoadPackageResource 

should be the on responsible for loading any dependent assemblies rather than throwing an exception.  Would have saved me and others the trouble of interrupting their development to (hopefully) hunt down this thread and implement a work around.  Just my 2c.

Eric
0
Stefan
Telerik team
answered on 09 Feb 2012, 10:35 AM
Hi Eric,

Thank you for your suggestion.

I will log it in our PITS system for a review and our dev team will decide whether such a functionality is possible and should be implemented. Here is a link to the PITS item, where you can add your vote for it and also you can track its status updates: http://www.telerik.com/support/pits.aspx#/public/winforms/9645.

I have updated your Telerik points for this feature request.
 
Kind regards,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Themes and Visual Style Builder
Asked by
Martin Horst
Top achievements
Rank 1
Answers by
Martin Horst
Top achievements
Rank 1
Nikolay
Telerik team
Chris Kirkman
Top achievements
Rank 1
Stefan
Telerik team
Eric
Top achievements
Rank 1
Share this question
or