Creating New Themes

8 posts, 0 answers
  1. Simeon
    Simeon avatar
    27 posts
    Member since:
    Jul 2012

    Posted 08 Jan 2010 Link to this post

    Hi,

    We are trying to create our own theme assemblies to allow us to create themes in our customers coparate colours.  The way I figured it we could create a customer specific assembly and only download that resource for the correct customer.  I have started by taking the windows7 example solution and trying to change some of the brush resources.  When any of the theme projects compile they give warnings about a Media3d assembly not being found.  So I removed them and then the projects compile.  I then added a reference to the amended Windows7 theme dll and tried to set the application theme.  However when I do this I get a COM exception. 

    So I was looking for some guidance on creating custom theme's as the documention is somewhat sparse.  Ideally we are looking to create OfficeRed, OfficeGreen, OfficeRoyalBlue that sort of thing for our customers.

    We are on the 2009 Q3 Sp1 build 2009.3.1208.1030.   On a side note when we build the themes assemblies the get  a verion number of 0.0.0.0 could this be a cause of the problem?

    Cheers

  2. Simon Störmer
    Simon Störmer avatar
    33 posts
    Member since:
    Oct 2012

    Posted 12 Jan 2010 Link to this post

    Hi James,

    I am new to the Telerik Controls as well. But I am trying to create my own Theme as well, and I would like to share my results, perhaps they can help you. I looked at the Telerik themes and the way they are made up. I tried the following way and it worked so far:

    1. Create a Silverlight class lib Assmebly that contains only of the XAML files. One .XAML file for each control and one Generic.xaml that references to the style files as merged dictionaries.

    2. Within the "main" Silverlight project, create a class MyTheme that derives from theme. In the consturctor set the base classes Source-Property the a uri pointing to your Theme assemblys generic.xaml file.

    3. Within the App.xaml.cs of the "main" Silverlight project, set an instance of MyTheme class as ApplicationTheme. This must be done as early as possible (I did it wihtin the constructor) in order to take effect.

    I have a sample project I can send you, but I don't know how to upload it here. If you are interested, tell me your Email-Address and I will send it to you.

    My own question, that I posted on http://www.telerik.com/community/forums/silverlight/general-discussions/create-a-custom-theme-based-on-exisiting-one.aspx goes a little further: how can I create my custom style based on an exisiting style? So that it uses for example office blue for all controls expect the ones I explicitly define otherwise. Any ideas on this will be appreciated.

    Greetings,

    Tobias.

     

  3. Simeon
    Simeon avatar
    27 posts
    Member since:
    Jul 2012

    Posted 12 Jan 2010 Link to this post

    Hi Tobias,

    I read your post before I posted my thread.  If I am reading the help file correctly I think we have to create our styles as an actual theme resource dll and change the colours on the controls you are intrested in.  That is what we are trying to do really.  I have opened the theme solution that is installed as part of Telerik controls for silverlight and taken a copy of the office blue one and changed all of the resources to use a red gradient.  This theme compiles as a new assembly and can be accessed in the code behind when referenced but when I set the application theme to the new one I get a COM exception now.

    I'll wait a few days to see if anyone replies here before opening a support ticket.

    Cheers,
  4. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 14 Jan 2010 Link to this post

    Hello James Nelson,

    Please, accept our apologies for the late reply. In the attached file you can find a project containing the office_blue theme for all our controls. In case you want to customize some other theme you can find its project in the "Theme" folder under your installation folder. Should you have any further questions, please, do not hesitate to write us.

    Best wishes,
    Dimitrina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Simeon
    Simeon avatar
    27 posts
    Member since:
    Jul 2012

    Posted 14 Jan 2010 Link to this post

    Hi Dimitrina,

    Sorry I think you have misunderstood what we are trying to acheive.  I am not trying to customize a theme,  I am trying to add a brand new theme (I am using only using a supplied telerik theme as a basis).  So where in a application you would add a reference to Telerik.Windows.Themes.Windows7.dll and then in my application I would use a bit of code like

    Telerik.Windows.Controls.

    StyleManager.ApplicationTheme = new Windows7Theme();

     


    to set my application theme to be windows7.  I want to do the same thing using my assembly and custom theme type. 

    Cheers,

    Jim.   
  6. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 14 Jan 2010 Link to this post

    Hello James Nelson,

    I believe that the application I attached to my previous mail shows the needed approach, but in XAML. Therefore, this time I attached a sample app, where I set the new theme in the codebehind, like:

    public MainPage()
            {
                StyleManager.ApplicationTheme = new Windows7Theme();
                InitializeComponent();
            }

    I hope this will get you started.

    Kind regards,
    Dimitrina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Simeon
    Simeon avatar
    27 posts
    Member since:
    Jul 2012

    Posted 15 Jan 2010 Link to this post

    Sorry maybee I did not explain it correctly. 

    What we are trying to achieve is a brand new theme assembly Mandata.Windows.Themes.OfficeRed.dll.  So I haved followed the help file and inherited the telerik theme class and have all of the xaml that you would use in your windows7 theme.  But, when I try to set it as the application theme I get a COM exception.  So I suppose what I was looking for was a solution that kind of did this as and brand new theme that is not included in Telerik.Windows.Controls.dll.

    Cheers,
  8. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 21 Jan 2010 Link to this post

    Hi James Nelson,

    Please, accept our apologies for the late reply. In the below link you can find how to create a new theme:

    http://www.telerik.com/community/forums/silverlight/radcontrols-for-silverlight-3-official/create-custom-theme-dll-for-q3-2009.aspx#1007817

    As for the Telerik.Windows.Controls assembly - you will have to always refer it as it contains other important classes that are used by the rest of the controls and this assembly also contains the theming mechanism itself.

    If you have further questions please do not hesitate to ask us.

    I hope this will help you.

    Sincerely yours,
    Dimitrina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top