FlexGrid and Themes

Originally Posted 28 July 2017, 2:33 am EST

  • Originally Posted 28 July 2017, 2:33 am EST

    I have an interesting problem that appeared after one of the C1 updates, what happens is that when a theme is changed, the FlexGrid loses its word wrapping function until the application is restarted, every other aspect of the grid format remains correct.
  • Reply

    Hi,

    I am unable to replicate the issue at my end using the latest build of WinForms. Please check the behavior with the latest build:
    http://prerelease.componentone.com/dotnet20/c1winforms/2017-t2/C1WinForms.2_2.0.20172.271.zip
    http://prerelease.componentone.com/dotnet40/c1winforms/2017-t2/C1WinForms.4_4.0.20172.271.zip

    If the issue still exists, please provide a stripped down application demonstrating the behavior. I would like to investigate this further.

    ~Pragati
  • Reply

    I have a pretty good Idea what is happening, I am using ThemeController themes and once I apply one to the FlexGrid these settings are negated.

    FlexGrid.Styles.Normal.WordWrap = true;
    FlexGrid.Styles.Normal.Margins.Left = 2;
    FlexGrid.Styles.Normal.Margins.Right = 1;
    FlexGrid.Styles.Normal.Margins.Top = 3;
    FlexGrid.Styles.Normal.Margins.Bottom = 3
  • Reply

    And it is fixed this way.

     
    private void ThemeManager_ObjectThemeApplied(C1.Win.C1Themes.C1ThemeController sender, C1.Win.C1Themes.ObjectThemeEventArgs e)
    {
    if(e.Object == FlexGrid)
    {
    FlexGrid.Styles.Normal.WordWrap = true;
    FlexGrid.Styles.Normal.Margins.Left = 2;
    FlexGrid.Styles.Normal.Margins.Right = 1;
    FlexGrid.Styles.Normal.Margins.Top = 3;
    FlexGrid.Styles.Normal.Margins.Bottom = 3;
    }
    }
  • Reply

    Hi,

    We are glad to know that you could resolve the issue for yourself.
    However, we would like to mention using your code snippet for changing themes (we could not use ToWriteSettings and ToWriteThemeSettings, since they were not defined), we could not reproduce the issue at our end using 4.0.20172.271 build version. Please refer to attached video and sample application used for testing the issue at our end.
    If you could modify the application or share your application, then it would really help us get the issue fixed(if there is any) and help customers in future.

    Thanks & Regards,
    Ruchir Agarwal
    2017/08/ThemeChangeC1FlexGrid.gif

    2017/08/prj_ThemeChangeResettingWrap.zip
  • Reply

    The ToWriteSettings and ToWriteThemeSettings are just flags that tell the application that a successful change in configuration was made and that it is safe to change appSettings. The problem I found was fixed by looking at one of your examples that you provide with the controls.
  • Reply

    Its very simple really and once it changes all formatting such as word wrapping and col/row sizing is gone until a reset.

    private void ThemeChange_Handler()
    {
    try
    {
    appConfig.ProgramTheme = rbThemeCombo.SelectedItem.Text;
    C1ThemeController.ApplicationTheme = appConfig.ProgramTheme;
    ToWriteSettings = true;
    ToWriteThemeSettings = true;
    }
    catch (Exception ex)
    {
    ToWriteSettings = false;
    throw new ApplicationException("ThemeChange_Handler!", ex);
    }
    }
  • Marked as Answer

    Reply

    Hello,

    Thank you for sharing details about the ToWriteSettings and ToWriteThemeSettings flags.

    However, as mentioned in previous reply we could not reproduce the issue at our end using your code snippet. Therefore, in order to proceed further with this case, we request you to please modify the sample application or share an application replicating the issue.
    Also, could you please specify the name of the "example" that helped you in resolving the issue,as it might help us in reproducing the issue at our end.

    We need these informations so that we may replicate and fix any issue(s) present in C1FlexGrid and help customers over this community.

    Regards,
    Ruchir Agarwal
Need extra support?

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

Learn More

Forum Channels