Lightweight Templates to Reduce Memory Consumption / TELERIK COLOR THEME GENERATOR

8 posts, 0 answers
  1. Barry
    Barry avatar
    90 posts
    Member since:
    May 2016

    Posted 02 Aug 2019 Link to this post

    In reference to: https://www.telerik.com/blogs/how-to-boost-radgridview-performance-for-wpf-and-silverlight-using-lightweight-templates

     

    I just discovered your new TELERIK COLOR THEME GENERATOR. (very cool by the way :-)

    1) Are the "CHOOSE THEME" items the lightweight templates ?

    2) If the answer to 1) is yes, will modifying anything in the tool increase the "weight" ?

    3)The "Office2016Touch" template is almost a perfect match to our current color scheme, so we'd likely go with that...is it "lightweight" ?

     

    Thanks in advance,

    Barry

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2444 posts

    Posted 05 Aug 2019 Link to this post

    Hello Barry,

    Thank you for the kind words about the Color Theme Generator. 

    The RadGridView in the Color Theme Generator application doesn't use the lightweight templates. And even if it was using those, modifying the colors in the tool wouldn't affect their "weight". 

    The Office2016Touch theme also has lightweight templates, but as any other theme you will need to enable them explicitly. I've attached a small example showing how to do this. I hope it helps.

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Barry
    Barry avatar
    90 posts
    Member since:
    May 2016

    Posted 12 Aug 2019 in reply to Martin Ivanov Link to this post

    Thanks...I was on vacation for a week :-)
  4. Barry
    Barry avatar
    90 posts
    Member since:
    May 2016

    Posted 12 Aug 2019 in reply to Martin Ivanov Link to this post

    Is the regular "Telerik.Windows.Themes.Office2016.dll" lightweight ?
  5. Barry
    Barry avatar
    90 posts
    Member since:
    May 2016

    Posted 12 Aug 2019 Link to this post

    This is what we were using:

    StyleManager.ApplicationTheme = new Windows7Theme();

    ...not sure if that is "lightweight" or not ?, but on top of it we defined a ton of customized styled that were applied to the Telerik controls all over the place.

    The Office2016Touch template seems to be optimized for mobile devices and the objects are enlarged accordingly. The Office2016Theme however is more designed for desktop apps I think, and has the same color scheme....so I think our preference would be that - I just need to know if it's lightweight ??? :-)

     

    Thanks,

     

    Barry

     

    StyleManager.ApplicationTheme = new Office2016Theme();
    Office2016Palette.Palette.AccentColor = (Color)ColorConverter.ConvertFromString("#FF2A579A"); //header backgrounds
                    Office2016Palette.Palette.AccentFocusedColor = (Color)System.Windows.Media.ColorConverter.ConvertFromString("#FF88C3FF");
                    Office2016Palette.Palette.AccentMouseOverColor = (Color)ColorConverter.ConvertFromString("#FF3E6DB6");
                    Office2016Palette.Palette.AccentPressedColor = (Color)ColorConverter.ConvertFromString("#FF19478A");
                    Office2016Palette.Palette.AlternativeColor = (Color)ColorConverter.ConvertFromString("#FFEEF3FC"); //ribbon background, grid header backgrounds (default: #FFF1F1F1)
                    Office2016Palette.Palette.BasicColor = (Color)ColorConverter.ConvertFromString("#FFABABAB"); //outlines and borders
                    Office2016Palette.Palette.ComplementaryColor = (Color)ColorConverter.ConvertFromString("#FFE1E1E1");
                    Office2016Palette.Palette.IconColor = (Color)ColorConverter.ConvertFromString("#FF444444");
                    Office2016Palette.Palette.MainColor = (Color)ColorConverter.ConvertFromString("#FFFFFFFF");
                    Office2016Palette.Palette.MarkerColor = (Color)ColorConverter.ConvertFromString("#FF444444");
                    Office2016Palette.Palette.MarkerInvertedColor = (Color)ColorConverter.ConvertFromString("#FFF9F9F9");
                    Office2016Palette.Palette.MouseOverColor = (Color)ColorConverter.ConvertFromString("#FFC5C5C5");
                    Office2016Palette.Palette.PressedColor = (Color)ColorConverter.ConvertFromString("#FFAEAEAE");
                    Office2016Palette.Palette.PrimaryColor = (Color)ColorConverter.ConvertFromString("#FFE6E6E6");
                    Office2016Palette.Palette.SelectedColor = (Color)ColorConverter.ConvertFromString("#FFEBEBEB");
                    Office2016Palette.Palette.ValidationColor = (Color)ColorConverter.ConvertFromString("#FFE81123");
                    Office2016Palette.Palette.DisabledOpacity = 0.5;

  6. Barry
    Barry avatar
    90 posts
    Member since:
    May 2016

    Posted 12 Aug 2019 Link to this post

    I'm looking at your example, and it all seems to be defined here:

     

    <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/System.Windows.xaml"/>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/Telerik.Windows.Controls.xaml"/>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
                </ResourceDictionary.MergedDictionaries>
                <Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowCoreStyle}"/>
                <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellCoreStyle}"/>
            </ResourceDictionary>
        </Application.Resources>

     

    ...so what part of this enables the "lightweight" version of the Office2016Touch templates ?.....or does just using this code enable the lightweight in general ?......switching it to "Office2016Theme" would get me the lightweight version of that style ? (as per my previous reply)

    Thanks....Barry

  7. Barry
    Barry avatar
    90 posts
    Member since:
    May 2016

    Posted 13 Aug 2019 Link to this post

    I'll pull this thread out of the public arena and open a "premium support" ticket :-)
  8. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2444 posts

    Posted 14 Aug 2019 Link to this post

    Hello Barry,

    The Telerik themes themselves are not "lightweight". Just they provide "lightweight" templates for few elements in the RadGridView control. All themes support "lightweight" templates - including the Office2016Theme.

    Keep in mind that "lightweight" templates are supported only with NoXaml dlls and the Implicit Styles theming mechanism. This is described in the Setting a Theme and Xaml vs. NoXaml articles. 

    The StyleManager is used along with the Xaml version of the dlls and it doesn't support the "lightweight" templates of RadGridView.

    The part that activates the "lightweight" templates is highlighted in the code snippet bellow. Basically, the two lines with the Style objects targeting GridViewRow and GridViewCell are the trigger. Those custom Style objects are based on the alternative "lightweight" styles (holding the "lightweight" templates) which replaces the default (the more heavy) templates of GridViewRow and GridViewCell.

    <Application.Resources>
    	<ResourceDictionary>
    		<ResourceDictionary.MergedDictionaries>
    			<ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/System.Windows.xaml"/>
    			<ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/Telerik.Windows.Controls.xaml"/>
    			<ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
    			<ResourceDictionary Source="/Telerik.Windows.Themes.Office2016Touch;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
    		</ResourceDictionary.MergedDictionaries>
    		<Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowCoreStyle}"/>
    		<Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellCoreStyle}"/>
    	</ResourceDictionary>
    </Application.Resources>

    Regards, Martin Ivanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top