This is a migrated thread and some comments may be shown as answers.

Color blending problem

5 Answers 118 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Constantinos Petridis asked on 25 Feb 2011, 04:13 PM
Hello, telerik community :)

While using the color blending mechanism, I noticed that if a rad control is created for the first time after the color blending takes place, that control will not have the blending changes.
In my application, as soon as I open the main form, I apply a theme and then a color blending.

If m_Theme = AvailableThemes.ControlDefault Then
    m_CurrentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme("ControlDefault")
    name = "ControlDefault"
Else
    If Not ThemeLoaded(name) Then
        ThemeResolutionService.LoadPackageResource(name & ".tssp")
    End If
End If
             
m_CurrentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme(name)
Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = name
m_CurrentTheme.AddColorBlend(blend.Name, blend.BaseHslColor)
m_CurrentTheme.ThemeProperties(blend.Name) = blend.BlendHslColor

AvailableThemes is an enumeration of theme names. All other themes except ControlDefault are assembly Resources (tssp files).

As soon as the main window of the application is shown, my theme "manager" loads the last used theme and applies a color blending to that theme.

It seems that rad controls, which are not loaded before the color blend, will not get the new colors. RadPageView is even worse, even if it is loaded (in my case, my main form has a RadPageView in stack viewmode), it will only apply the color blending to new RadPageViews of the same view mode (strip or stack).

To successfully apply color bindings in controls that will be created after the initial color blending, I have to add dummy controls (for example, a RadPageView with view mode strip) on my main form's control collection (with size 0,0 show that these controls don't show up) and after the application of color blending, I remove them.

Is this the desired functionality? I thought that color blending would be available to all controls using the theme that has the color blending.

Forgot to mention that I am using the latest dev release of RadControls for WinForms Q3 2010 (2010.3.10.1326).

5 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 03 Mar 2011, 04:00 PM
Hi Constantinos,

Thank you for sharing this issue with the community. I managed to reproduce it and I can confirm that it appears in our latest release. I added also the issue to our Public Issues Tracking System. You can track the issue by following this link and your Telerik points are updated accordingly.

You can work around the issue by applying the color blending twice. Should you have any further questions, I will be glad to help.

Best wishes,
Dobry Zranchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
answered on 03 Mar 2011, 04:56 PM
I tried to apply the color blend twice but it didn't solve  the problem.
This is my color blending function

Private Sub ColorBlendChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim blend As ColorBlendClass
    Dim radTheme As Theme
    Dim name As String
 
    blend = TryCast(sender, ColorBlendClass)
    If blend IsNot Nothing Then
        name = System.Enum.GetName(GetType(AvailableThemes), blend.Theme)
        radTheme = ThemeResolutionService.GetTheme(name)
 
        If Not radTheme.ThemeProperties.ContainsKey(blend.Name) Then
            radTheme.AddColorBlend(blend.Name, blend.BaseHslColor)
        End If
 
        radTheme.ThemeProperties(blend.Name) = blend.BlendHslColor
 
        If Me.m_Theme = blend.Theme Then
            Me.ToolStripColorBlend(blend)
        End If
         
        radTheme.NotifyThemeChanged()
    End If
End Sub

As you can see I have a class named ColorBlendClass that just keeps the blending options, name etc and fires events when an options dialog change the blending colors. When that happens, the above function is called to apply the new color blending.
Following what you have suggested (applying the color blending twice), I tried two approaches, as I didn't know what you meant exactly.

First I tried calling the ThemeProperties property twice as seen bellow.
If Not radTheme.ThemeProperties.ContainsKey(blend.Name) Then
    radTheme.AddColorBlend(blend.Name, blend.BaseHslColor)
End If
 
radTheme.ThemeProperties(blend.Name) = blend.BlendHslColor
radTheme.ThemeProperties(blend.Name) = blend.BlendHslColor

When that didn't work, I tried to add two different color blendings with the same values (but with different names). Still the color blend did not apply to a RadPageView (strip mode), that was for the first time created after the color blending.

What exactly did you mean when you said to apply the color blending twice?
0
Accepted
Dobry Zranchev
Telerik team
answered on 08 Mar 2011, 06:36 PM
Hello Constantinos,

Thank you for writing back.

The project that is attached in the post demonstrates how to apply the color blending to the newly created control.

If you have any questions related to this project, feel free to write back.

All the best,
Dobry Zranchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
answered on 09 Mar 2011, 09:00 AM
Thank you for your answer. The solution you provided does work but it is not very practical, since our application's UI is very dynamic (lots of form that open in a random order).
The only thing that bothers me is performance. If I have lots of Telerik forms and/or controls and reapply a color blending every time a new form is created, will that become visible to the user? I will have to try and see.
I will try to include your workaround and come back for more questions if I have any. :)

Thanks again.
0
Dobry Zranchev
Telerik team
answered on 15 Mar 2011, 08:07 AM
Hi Constantinos,

Thank you for writing back.

I am happy to hear that the project has helped you. Indeed, you may experience a short delay in your scenario, but this is the only solution that I can provide you with for the color blending feature. We will address the issue itself in one of our next releases. However, this is an issue of a base part of our framework and I cannot provide you with a time frame in which the issue will be addressed.

Greetings,
Dobry Zranchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Themes and Visual Style Builder
Asked by
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Answers by
Dobry Zranchev
Telerik team
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Share this question
or