Setting theme for c1Controls not working

Posted by: levanduyet on 2 September 2024, 2:06 am EST

  • Posted 2 September 2024, 2:06 am EST - Updated 2 September 2024, 2:12 am EST

    Hi,

    1, Set theme for controls on the form

    I have used theme designer to adjust a bit on the “Office2010Blue” and add to my project.

    The problem is that the input controls like c1Label, c1Checkbox,… not working.

    I have set the backcolor to transparent, but it still show.

    2, I have added the user theme on the c1ThemeController.

    How can I remove it.

    3, How to update user theme.

    If I have added the user theme on my project, if I want to update it, can I adjust directly on this user theme file and my project will update it also.

    Pls refer my test project and photos also.

    Thanks,

    Duyet Le

  • Posted 2 September 2024, 2:09 am EST - Updated 2 September 2024, 2:15 am EST

    Here is my code:

    using C1.Win.Ribbon;
    using System.Windows.Forms;
    
    namespace TestTheme
    {
        public partial class frmTestTheme : C1RibbonForm
        {
    
            #region set theme for controls on the form
            private void ScanControlsSetTheme(Control parentControl, string sTheme)
            {
                if (!string.IsNullOrEmpty(sTheme))
                {
                    if (C1.Win.Themes.C1ThemeController.IsObjectThemeable(parentControl))
                    {
                        this.c1ThemeController.SetTheme(parentControl, sTheme);
                    }
                    foreach (Control control in parentControl.Controls)
                    {
                        if (control.HasChildren)
                        {
                            if (C1.Win.Themes.C1ThemeController.IsObjectThemeable(control))
                            {
                                this.c1ThemeController.SetTheme(control, sTheme);
                            }
                            ScanControlsSetTheme(control, sTheme);
                        }
                        else
                        {
                            if (C1.Win.Themes.C1ThemeController.IsObjectThemeable(control))
                            {
                                this.c1ThemeController.SetTheme(control, sTheme);
                            }
                        }
                    }
                }
            }
            #endregion
            public frmTestTheme()
            {
                InitializeComponent();
                #region Set theme
                string sTheme = "Office2010Blue";
                this.ScanControlsSetTheme(this, sTheme);
                #endregion
            }
    
            private void c1ButtonTest_Click(object sender, System.EventArgs e)
            {
                MessageBox.Show("Background of c1Label: " + this.c1LabelTest.BackColor.Name +
                    "\nBackground of c1Checkbox: " + this.c1CheckBoxTest.BackColor.Name, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
    

    Thanks,

    Duyet Le

  • Posted 2 September 2024, 2:13 am EST

    Attached is my project file.

    Tks,

    Duyet LeTestTheme.zip

  • Posted 2 September 2024, 2:30 am EST

    Hi,

    it seems your code to set the theme can be simplified at lot ;-): you just apply the theme to the root control, and all child controls are handled by the C1ThemeController method:

    C1Theme theme = C1ThemeController.GetThemeByName("MyTheme", true);
    C1ThemeController.ApplyThemeToControlTree (this);

    Hope this helps

    Wolfgang

  • Posted 2 September 2024, 10:55 pm EST - Updated 2 September 2024, 10:55 pm EST

    Hi Wolfgang,

    Thanks for your suggestion.

    Actually,

    C1Theme theme = C1ThemeController.GetThemeByName("MyTheme", true);
    C1ThemeController.ApplyThemeToControlTree (this, **theme**);

    But my problem still there.

    Duyet Le

  • Posted 3 September 2024, 3:03 am EST

    Hi Duyet,

    your sample zip file seems to be broken, I cannot unzip it.

    Best remove the “.vs”, “bin” and “obj” folders before zipping, this reduces size of the file.

    Best regards

    Wolfgang

  • Posted 3 September 2024, 6:04 am EST - Updated 3 September 2024, 6:09 am EST

    Hi Duyet Le,

    Thanks for providing the detailed information about your issues.

    1. We could replicate this issue when these input controls are placed inside C1Sizer control. We are discussing this issue with our developers. [Internal Tracking ID: C1WIN-32890]

    We will update you on this as soon as we hear back from them.

    1. C1ThemeController picks the user themes from the “Themes” folder of the project. You can remove the theme from this folder to remove it from the list. Here is the GIF that shows this process:

    2. You can update the theme used via C1ThemeDesigner application only. You can open the theme file present in the project’s “Theme” folder in the C1ThemeDesigner application. Do the desired modifications and save the file. Rebuilding the project will reflect the updates. Here is the GIF that shows the process:

    Hope this helps!

    Thanks & Regards,

    Aastha

  • Posted 3 September 2024, 8:47 am EST

    Hi Aastha,

    Noted.

    Duyet Le

  • Posted 20 September 2024, 9:24 am EST

    Hi Aastha,

    Any update on this issue.

    Thanks,

    Duyet Le

  • Posted 22 September 2024, 11:41 pm EST

    Hi Duyet,

    The developers have identified this issue as a bug. We’ve requested an ETA for the fix and will update you as soon as we receive their response.

    Thanks & Regards,

    Aastha

  • Posted 23 September 2024, 11:07 pm EST

    Hi Duyet,

    As per the developers, the ETA for the fix of this issue is 2024v2 HF2, which is expected to be released by the end of March 2025.

    We kindly request you to wait for the release to be publicly available, in order to get the fix of this issue.

    Thanks & Regards,

    Aastha

Need extra support?

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

Learn More

Forum Channels