Ribbon vs. C1Ribbon

Posted by: SHanau on 12 March 2022, 1:35 pm EST

    • Post Options:
    • Link

    Posted 12 March 2022, 1:35 pm EST

    Hi there,

    I’m currently testing the new Ribbon as our app currently uses the Classic Ribbon and we want to give it a design upgrade.

    The Classic Ribbon had a built-in “Custom” style which allowed us to manipulate the background color of a menu item as well as the brightness of the RibbonForm itself by using RibbonStyle.UpdateInstance(ThemeColor, ThemeLightness).

    I noticed that there is no “Custom” theme when I use C1ThemeController and as there still is Ribbon.UpdateInstance(…, …) it seems to have no effect. So, is there a method around to achieve the same behaviour with a built-in theme like “Office2016Colorful” ?

    Thanks in advance,

    Stephan

  • Posted 14 March 2022, 4:31 am EST - Updated 3 October 2022, 10:34 pm EST

    Hi Stephan,

    it is possible to modify a theme by code.

    Here is a snippet from our code. We use it to modify the C1FlexGrid.Styles.SelectedColumnHeader backcolor.

    Though this is not your requirement, it hopefully gives a hint.

    
    C1Theme theme = C1ThemeController.GetThemeByName("Office2010Silver", true;
    
    BackgroundProp propHeader = (BackgroundProp)this.theme.Children.GetItemByPath("C1FlexGrid\\Styles\\SelectedColumnHeader\\Background");
    propHeader.Value = new ThemeSolidBackground(Color.Khaki);
    
    
    

    The argument to “theme.Children.GetItemByPath” is a path that can found in the C1ThemeDesigner (“C:\Program Files (x86)\ComponentOne\Apps\v4.5.2\C1ThemeDesigner.4.5.2.exe”):

    So, you have to identify the path that points to the properties you want to modify. The theme lightness seems to be found at “C1Ribbon\Palette\ThemeLightness”.

    Hope this helps

    Wolfgang

  • Posted 14 March 2022, 5:03 am EST

    Hi Stephan,

    In the new C1.Win.Ribbon.C1Ribbon, the RibbonStyle.UpdateInstance method only takes effect when no theme is applied to the RibbonForm. Whenever a theme is applied, the RibbonForm follows its properties instead and the UpdateInstance method has no effect.

    If you want to change the properties of a built-in theme like “Office2016Colorful”, you can easily create your own custom theme in the C1ThemeDesigner application using the required built-in theme as the base theme and change its ThemeColor and ThemeLightness properties. Then you can use the C1ThemeController to apply these custom themes to your RibbonForm through code. Kindly refer to the attached sample.

    You can refer to the link below for more information related to the C1ThemeDesginer Application

    https://www.grapecity.com/componentone/docs/win/online-themes/ThemeDesignerAppOverView.html

    Best Regards,

    Kartik

    RibbonThemeDemo.zip

    PS. Thanks for the suggestions, Wolfgang!

  • Posted 2 April 2022, 7:46 am EST

    Hi Wolfgang, Hi Kartik,

    Thanks very much to both of you for your support. It did help a lot.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels