How do I change Disabled background color for RadPageView tabs?

1 Answer 149 Views
PageView Themes and Visual Style Builder
Julian
Top achievements
Rank 1
Julian asked on 05 Jul 2023, 01:23 PM

Hello,

I have a RadPageView control with Windows 8 theme and strip view mode.

When I disable the control, the color of the strip behind the tabs changes to a dark gray. I do not want it to change, but to stay in control color.

If I use the EnabledChange event and change the ItemContainer.BackColor of the StripElement it still shows the dark gray first.

 

I have seen that this is possible for example in Fluent theme, but want to use Windows 8 theme for my application.

I would love to use an easy way (SetThemeValueOverride) if possible. But I also haven't found a fitting property in the theme's style repositories and groups


 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 10 Jul 2023, 09:01 AM

Hi Julian,

To achieve your scenario, you need first to disable the default disable colors by setting the UseDefaultDisabledPaint property to false of the Item property. Then you use SetThemeValueOverride() method.

public Form1()
{
    InitializeComponent();
    this.radPageViewPage1.Enabled = false;
    this.radPageViewPage1.Item.UseDefaultDisabledPaint = false;
    this.radPageViewPage1.Item.SetThemeValueOverride(LightVisualElement.BackColorProperty, Color.Yellow, "Disabled");
    this.radPageViewPage1.Item.SetThemeValueOverride(LightVisualElement.GradientStyleProperty, GradientStyles.Solid, "Disabled");
    this.radPageViewPage1.Item.SetThemeValueOverride(LightVisualElement.ForeColorProperty, Color.Red, "Disabled");
}

Here is the result:

I hope that this approach will work for you when the Windows8 theme is used.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Julian
Top achievements
Rank 1
commented on 10 Jul 2023, 10:44 AM

Thank you, but this is not exactly what I was asking for.

I want to change the disabled color of the background of the strip element, not the items. 

In the example it is the area to the right af the three tabs.

I have tried different approaches, with no success:

 


RadPageViewStripElement strip = Sichten.ViewElement as RadPageViewStripElement;

if (strip != null)
{
       strip.ItemContainer.UseDefaultDisabledPaint = false;
       strip.ItemContainer.SetThemeValueOverride(VisualElement.BackColorProperty, Color.Black, "Disabled");

       strip.ItemContainer.ItemLayout.UseDefaultDisabledPaint = false;
       strip.ItemContainer.ItemLayout.SetThemeValueOverride(VisualElement.BackColorProperty, Color.Black, "Disabled");

       strip.ItemContainer.ButtonsPanel.UseDefaultDisabledPaint = false;
       strip.ItemContainer.ButtonsPanel.SetThemeValueOverride(VisualElement.BackColorProperty, Color.Black, "Disabled");
}
When disabled, it is always the dark gray
Dinko | Tech Support Engineer
Telerik team
commented on 12 Jul 2023, 12:31 PM

Thank you for elaborating your approach. To achieve it, you should set the UseDefaultDisabledPaint property of the RootElement to false. Thus, the desired color will be applied. However, note that in this case if you have other controls in the page view you should take care of their look when they are disabled as well. 

RadPageViewStripElement stripElement = (RadPageViewStripElement)this.radPageView1.ViewElement;
this.radPageView1.RootElement.UseDefaultDisabledPaint = false;          
stripElement.UseDefaultDisabledPaint = false;
stripElement.ItemContainer.SetThemeValueOverride(RadPageViewStripElement.BackColorProperty, Color.Red, "Disabled");

Nevertheless that the control looks active, it is in disable state due to setting the UseDefaultDisabledPaint to false of that RootElement.

Julian
Top achievements
Rank 1
commented on 12 Jul 2023, 12:54 PM

Thank you, that was what I was looking for!
Tags
PageView Themes and Visual Style Builder
Asked by
Julian
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or