Theme and AddColorBlend, NOT Working.

4 posts, 1 answers
  1. Lee
    Lee avatar
    48 posts
    Member since:
    Feb 2010

    Posted 04 Apr 2010 Link to this post

    Hi
    i am pissed off... this little code is not working past 3 hrs.
    What i want to do is apply breeze theme with "RED" color instead of "Blue" color. 
    I am trying to do as show in example "Integration/Theme color blending".  but don;t know what i am missing.

     

    private void Form3_Load(object sender, EventArgs e)

     

    {

     

    this.masterCountryTableAdapter.Fill(this.dsDataSet.MasterCountry);

     

     

    ThemeResolutionService.ApplyThemeToControlTree(this.radGridView1, "Breeze");

     

    }


     

    private void button1_Click(object sender, EventArgs e)

     

    {


    currentTheme =

    ThemeResolutionService.GetTheme("Breeze");

     

     

    //if (currentTheme.ThemeProperties.ContainsKey("BaseColor"))

     

     

    //{

     

     

    // this.colorForm.SelectedHslColor = (HslColor)currentTheme.ThemeProperties["BaseColor"];

     

     

    // return;

     

     

    //}

     

     

    HslColor baseColor = HslColor.FromColor(Color.FromArgb(250, 0, 0));

     

     

    //this.colorForm.SelectedHslColor = baseColor;

     

    currentTheme.AddColorBlend(

    "BaseColor", baseColor);

     

    }
  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 08 Apr 2010 Link to this post

    Hello Lee,

    Thank you for the question.

    As described in this help article, you need to set the ThemeProperties of the currentTheme instance. However, there is no such setting in your code snippet. In addition, the baseColor instance should actually contain the base color which appears originally in the Breeze theme, but not the color that you want to set. Please refer to the correct code snippet which will make the Breeze theme red:
    Theme currentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme("Breeze");
    HslColor baseColor = HslColor.FromArgb(255, 56, 154, 254);
    currentTheme.AddColorBlend("BaseColor", baseColor);
    currentTheme.ThemeProperties["BaseColor"] = HslColor.FromArgb(255, 254, 56, 56);

    I hope this helps. If you have additional questions, feel free to contact me.

    Greetings,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Lee
    Lee avatar
    48 posts
    Member since:
    Feb 2010

    Posted 08 Apr 2010 Link to this post

    Wow! Thanks Nikolay , That did worked.

    I can see the difference between my and your code and i believe, I miss-used function Argb.  I understand r,g,b . but what does 'A' stands for?   (  I see that we have specified 255 value for 1st parameter of the function.  )

    Few more questions.
    1. like ThemeProperties["BaseColor"]  what are other properties, I can play around with.?   Do we have a list?

    2. Eg. at http://www.telerik.com/help/winforms/color_blending_.html   it says "If the resulting skin still needs some touches, you can export the modified theme data to xml files".   How to export  theme modified at runtime ?  is there any example for it?


    Regards
    lee.
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 14 Apr 2010 Link to this post

    Hi Lee,

    The 'A' letter stands for the Alpha value of the defined color. For additional information about the FromArgb signature, please refer to MSDN.

    The BaseColor value that used to get an item from ThemeProperties is actually the value defined before that in the added color blend. It does not matter whether the BaseColor string is called BaseColor1 or BaseColor5, it is important that you get an item from the ThemeProperties by passing the value defined for the color blend.

    As to the process of exporting your blended themes, please refer to the attached sample project. It demonstrates the approach that you should follow.

    I hope this helps. If you have additional questions, feel free to contact me.

    Best wishes,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top