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

Themes Dll

12 Answers 745 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Paul Gallen
Top achievements
Rank 1
Paul Gallen asked on 03 Dec 2008, 05:50 PM
Hi,

Is it possible to have an assembly with embedded themes, then reference that assembly across different projects in the same solution. Then using the radthememangaer - Load Themes from Resource - point to the compiled assembly.

My UI is split across different projects. How can I share the same themes across multiple projects?


P

12 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 04 Dec 2008, 08:15 AM
Hi Paul Gallen,

Thank you for this question.

Your scenario is possible. Please refer to the following Knowledge Base article for additional information: Creating a theme component. Note that you do not need RadThemeManager in this case.

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

Greetings,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 04 Dec 2008, 09:52 AM
Hi Nikolay,

This sounds great, I am trying it out now. While I am doing this, what standard should you adopt when creating  themes? For example:- In the sample that you supplied you have two xml files, one for the listbox and the other for the scrollBar,

1, could you just create on XML file with both the ListBox and scrollbar combined?
2, could I have multiple class in my component with different themes?
3, I have a requirement that a label has two themes - would this be achieved in two separate xml files?


Thanks


K
0
Paul Gallen
Top achievements
Rank 1
answered on 04 Dec 2008, 10:11 AM
Oh BTW,

I added your 'desert' theme to my designer surface, I then applied the theme to a label, I then removed the theme, however the theme still appears in the smart tag of the label. How can I clear this option from my smart tag?

Thanks

P
0
Nikolay
Telerik team
answered on 09 Dec 2008, 09:59 AM
Hello Paul Gallen,

Thank you for getting back to us.

Please find the answers to your questions below:
  1. Yes, you can create just one theme for RadListBox and its scrollbars. In the sample project provided, the ListBox.xml theme contains settings for both RadListBox and its scrollbars. The ScrollBar.xml theme is needed only for the RadVScrollBar right aligned on the form.
  2. In your theme project you can have several .cs files representing the components.
  3. For the different themes for one control you should create separate theme files.

Regarding your last question, the themes' registrations are kept in the Visual Studio's static memory. So, in order to remove the option from the smart tag, you should close and then reopen Visual Studio. This will clear its memory.

If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Gallen
Top achievements
Rank 1
answered on 09 Dec 2008, 01:53 PM
Sorry to be a nuisance but I am having an awful time with your themes (sorry for reporting thick)!

I have created two theme files CMXLabel.xml and CMXLabelHeader.xml. Using your std way of accessing theme through a component I have made the following entries.

 

 

ThemeResolutionService.RegisterThemeFromStorage(ThemeStorageType.Resource,

 

"FTS.CMX.Themes.CMXLabel.xml")

 

ThemeResolutionService.RegisterThemeFromStorage(ThemeStorageType.Resource,

"FTS.CMX.Themes.CMXLabelHeader.xml")
Both of these files are compiled as an embedded resource

CMXLabel has a font of Tahoma 9 pt
CMXLabelHeader has a font of Tahoma 9pt bold

First of all CMXLabelHeader does NOT show up in my smart tags for a radLabel.

Secondly CMXLabel does show up in my smart tags, which I applied a theme, OK. Now.... I changed the CMXLabel theme again using your visual style builder tool to change the font to 8.25pt, saved the file, recompiled my component, rebuilt my project, went to my label, reset the ThemeName, reapplied the CMXLabel theme and it did NOT change the theme. In fact using the reset does not seem to do anything AT ALL. I am seem to be stuck with this theme.

P

 

 

 

 

 



0
Accepted
Nikolay
Telerik team
answered on 12 Dec 2008, 03:21 PM
Hello Paul Gallen,

Regarding your first issue, please make sure that your theme files have different ThemeNames. Otherwise, if the theme files have the one and the same ThemeName, you will not be able to see the choices in the ThemeName dropdown. I am attaching a movie where the correct behavior is demonstrated.

As to your second issue, where the changes are not applied at design-time, I was able to reproduce it. It will be addressed in one of our next versions. For the time being, you can get the appearance updated by closing and then reopening Visual Studio.

I have updated your Telerik points account for the report. If you have additional questions, feel free to contact me.

Best wishes,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Afraei
Top achievements
Rank 1
answered on 15 Feb 2013, 09:37 AM
Hi Nikolay,

I have created the class library as the linke (Creating a theme component) stated, then have compiled the project  and my Theme.dll was created but still I can't find and see the theme component in the toolbox.

Could you please help me why I can't do this?

Thanks
0
Nikolay
Telerik team
answered on 18 Feb 2013, 11:41 AM
Hi Afraei,

In order to be able to assist you with a helpful response, I will need a sample project of yours which demonstrates how exactly the theme component is created. Please open a new support ticket and send the sample project there.

Note that according to your current Visual Studio settings, a component may not be automatically loaded in the Toolbox. In that case, from the main Visual Studio menu you need to choose Project >> Refresh Project Toolbox Items.

Regards,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Afraei
Top achievements
Rank 1
answered on 19 Feb 2013, 09:25 AM
Hi again Nikolay,

Is it possible to use theme package instead of theme XMLs in order to create theme component?

I will refresh toolbox and hope to work.
Regards
0
Nikolay
Telerik team
answered on 21 Feb 2013, 09:56 AM
Hi Afraei

Yes, you can use a theme package file (*tssp) in the theme class library. In order to load the theme package file in the library, however, you need to use a slightly different code snippet:

[ToolboxItem(true)]
public class Office2010BlueTheme : RadThemeComponentBase
{
    static bool loaded = false;
 
    public Office2010BlueTheme()
    {
        ThemeRepository.RegisterTheme(this);
    }
 
    public override void Load()
    {
        if (!loaded || IsDesignMode)
        {
            loaded = true;
            Assembly resourceAssembly = typeof(Office2010BlueTheme).Assembly;
            LoadResource(resourceAssembly, "Telerik.WinControls.Themes.Office2010Blue.tssp");
        }           
    }
 
    public override string ThemeName
    {
        get
        {
            return "Office2010Blue";
        }
    }
}

This is how the Office2010BlueTheme component is made. There, the file name of the tssp file is Office2010Blue.tssp and the default namespace of the class library project is Telerik.WinControls.Themes. Again, the Build Action of the tssp file should be set to Embedded Resource.

I hope this helps.

Greetings,
Nikolay
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
NorthGates
Top achievements
Rank 1
answered on 09 Apr 2013, 05:36 AM
Can you elaborate, I just tried the example above but get a design time error (could not find type 'myassy.mytheme' ... although my themes dll is referenced) when re-opening the form where my theme is added and once added (before closing/reopening my form), I cannot see it in the ThemeName listbox. I like the idea to use the .tssp file instead of many xmls.

Ok, I looked further down and found a sample. Will try that one.. sorry.. :-)
0
Nikolay
Telerik team
answered on 12 Apr 2013, 11:05 AM
Hi NorthGates,

I am glad to hear that you have found a sample that covers the case. If you still experience any issues, please open a new support ticket and send me a sample project which demonstrates the described behavior. This will allow me to assist you further with an adequate response.

Greetings,
Nikolay
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
Themes and Visual Style Builder
Asked by
Paul Gallen
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Paul Gallen
Top achievements
Rank 1
Afraei
Top achievements
Rank 1
NorthGates
Top achievements
Rank 1
Share this question
or