buttons just change in colour

12 posts, 1 answers
  1. Ian
    Ian avatar
    22 posts
    Member since:
    Nov 2010

    Posted 05 Jan 2011 Link to this post

    Hi!

    Can anyone help me with this? Urgent please.
    I'm using radButtons. The GradientStyle is Linear. But when I switch forms, all (as in all) the radButtons in all forms change to GradientStyle Solid. I noticed this when we upgraded to Q3 2010. 

    Thanks,

    Ian
  2. Ian
    Ian avatar
    22 posts
    Member since:
    Nov 2010

    Posted 05 Jan 2011 Link to this post

    Hi,

    Additional information. 
    I noticed that the gradient property just changed to solid (in all buttons. I even added new button and the gradient style changes too) even though there is no code to programmatically change it.

    I temporarily created a work around because we urgently need it for presentation. But I hope I can really fix the issue. Thank you.

    My work around:
    ButtonElement.ButtonFillElement.PropertyChanged += new PropertyChangedEventHandler(ButtonFillElement_PropertyChanged);
     void ButtonFillElement_PropertyChanged(object sender, PropertyChangedEventArgs e)
            {
                var fillPrimitive = sender as Telerik.WinControls.Primitives.FillPrimitive;
                if (e.PropertyName == "GradientStyle")
                {
                    if (fillPrimitive != null && fillPrimitive.GradientStyle == Telerik.WinControls.GradientStyles.Solid)
                        fillPrimitive.GradientStyle = Telerik.WinControls.GradientStyles.Linear;
                }
            }

    Kind regards,

    Ian



  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Jan 2011 Link to this post

    Hi Ian,

    I saw that someone else had reported somethig similar recently but I was unable to replicate it at the time. Please can you tell nme a bit more about your situation? E.g. Switching forms.. Is this an MDI app, using radDock? Just two different forms open?
    If you can give me a scenario, I'll see if I can replicate it.
    Richard
  5. Ian
    Ian avatar
    22 posts
    Member since:
    Nov 2010

    Posted 05 Jan 2011 Link to this post

    Hi Richard,

    Thank you for your reply.

    The scenario is this. The management decided to change the design of the current application. We found out that some of the designs they wanted can be done using Telerik controls. We changed the old 3rd party controls with Telerik. (In most cases, we changed it in the InitializedComponent() procedure). The buttons are then set to linear gradient style. 

    These buttons are in custom user controls (most of the user controls contains a complete screen for user interaction) where in depending on user actions, the custom user controls are shown or hidden (or loaded or unloaded). 

    When showing (loading etc) the custom user control, the gradient style just changed to solid even if there's no code to change it. (I tracked it first using the RadControlSpyForm and then using the snippet I posted earlier. The changing also happened when I load a new form (show dialog) and/or when I just disable enable a button (e.g. repeat button). 

    I search the entire solution of ".GradientStyle = GradientStyles.Solid" to make sure there's no code that programmatically change it to solid. I only found 2 in
      private void dataGrid_CellFormatting(object sender, CellFormattingEventArgs e)
            {  if (bfValue >= bfRed)
                {
                    e.CellElement.DrawFill = true;
                    e.CellElement.GradientStyle = GradientStyles.Solid;
                    e.CellElement.BackColor = colourRed;
                    e.CellElement.BackColor2 = colourRed;
                }
                else if (bfValue >= bfYellow)
                {
                    e.CellElement.DrawFill = true;
                    e.CellElement.GradientStyle = GradientStyles.Solid;
                    e.CellElement.BackColor = colourYellow;
                    e.CellElement.BackColor2 = colourYellow;
                }
    }
    I commented it but still, the problem is there. 

    Then I search for this..."GradientStyles.Solid" and I found codes same as the sample below in the designer part. 
    this.keyGrid.HeaderGradientStyle = Telerik.WinControls.GradientStyles.Solid;

    We are not using MDI and radDock. This happened after we updated to Q3 2010 and when I tried to changed some element properties of the one of the buttons. I already reverted the changes but still, the problem is there.

    I hope I explained it clearly. The change property event of the gradient style fire each time I show/hide/load/unload a form or a custom user control even without explicitly changing it.

    Thank you very much,

    Ian 
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Jan 2011 Link to this post

    Hi Ian,

    I'm afriad I haven't been able to replicate this. I have tried the following
    • Create a form with a RadButton
    • On click of the RadButton, launch a second form
    • The second form has a user control that contains 3 RadButtons
    • On one of the RadButtons in the user control, I explicitly set the GradientStyle to Linear
    radButton3.ButtonElement.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Linear;
    this made no difference as it was already set to linear.

    If you can put together a demo that can replicate the issue, and post it here, I'll be happy to take a look.
    All the best
    Richard
  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Jan 2011 Link to this post

    One more thing Ian.
    Could you confirm the following: that you are using the Default theme, and that you are using the latest 2010 Q3 SP1 release as there were several UI glitches that were fixed in the latest service pack.
    Thanks
    Richard
  8. Ian
    Ian avatar
    22 posts
    Member since:
    Nov 2010

    Posted 05 Jan 2011 Link to this post

    Hi Richard,

    We are using the Default theme, and the version we are using is 2010.3 1109. I will try to create a demo after our presentation. Thanks a lot.

    Kind regards,

    Ian


  9. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Jan 2011 Link to this post

    Hi Ian,

    I'd suggest upgrading to 1215 (SP1). Here are the release notes for SP1. As you can see, there were visual issues fixed in the Control Default theme.
    The upgrade is painless and there shouldn't be anything in there that will cause you an issue as far as I'm aware.
    Hope that helps
    Richard
  10. Ian
    Ian avatar
    22 posts
    Member since:
    Nov 2010

    Posted 06 Jan 2011 Link to this post

    Noted. Thank you very much.
    Ian
  11. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 06 Jan 2011 Link to this post

    No problem Ian. If you upgrade and find that this works, please remember to mark as answer so others can find the solution too.
    All the best
    Richard
  12. Ian
    Ian avatar
    22 posts
    Member since:
    Nov 2010

    Posted 06 Jan 2011 Link to this post

    Hi Richard,

    I already installed the SP1 and removed the work around code. My problem is now solved. Thank you very much.

    Kind regards,

    Ian
  13. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 06 Jan 2011 Link to this post

    Glad that worked for you Ian
    Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready