Themes Dll

13 posts, 1 answers
  1. Paul Gallen
    Paul Gallen avatar
    156 posts
    Member since:
    Jun 2008

    Posted 03 Dec 2008 Link to this post

    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
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 04 Dec 2008 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Paul Gallen
    Paul Gallen avatar
    156 posts
    Member since:
    Jun 2008

    Posted 04 Dec 2008 Link to this post

    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
  5. Paul Gallen
    Paul Gallen avatar
    156 posts
    Member since:
    Jun 2008

    Posted 04 Dec 2008 Link to this post

    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
  6. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 09 Dec 2008 Link to this post

    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.
  7. Paul Gallen
    Paul Gallen avatar
    156 posts
    Member since:
    Jun 2008

    Posted 09 Dec 2008 Link to this post

    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

     

     

     

     

     



  8. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 12 Dec 2008 Link to this post

    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.
  9. Afraei
    Afraei avatar
    18 posts
    Member since:
    Jun 2012

    Posted 15 Feb 2013 Link to this post

    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
  10. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 18 Feb 2013 Link to this post

    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 >>
  11. Afraei
    Afraei avatar
    18 posts
    Member since:
    Jun 2012

    Posted 19 Feb 2013 Link to this post

    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
  12. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 21 Feb 2013 Link to this post

    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.
  13. NorthGates
    NorthGates avatar
    13 posts
    Member since:
    Oct 2012

    Posted 09 Apr 2013 Link to this post

    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.. :-)
  14. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 12 Apr 2013 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready