Completed
Last Updated: 02 Feb 2023 09:36 by ADMIN
Release R1 2023
Curtis
Created on: 31 Aug 2022 22:22
Category: RibbonForm
Type: Bug Report
0
RadRibbonBar: Backstage custom coloring causes Crash

Steps to reproduce:

Create new Telerik Windows Forms Application ( I use VB.net but this crashes in C# as well )

Create RadRibbonForm - set the Project so this is the Startup Form.

Add Office2013LightTheme to form.

Set RadRibbonBar1.ThemeName to Office2013LightTheme.

Set ApplicationMenuStyle property = BackstageView

 

Run the ap, click on the Backstage tab and you'll see the first Image attached (called First.png)

 

Close the ap and back to Visual Studio - with the Form open in the Designer.

 

Everything is set but now i want to change the Background color of that lovely blue panel and everything inside it to a new background color.

I'd like to do this without creating a new Theme.

 

Click on the little triangle thingie in the upper right corner and select "Edit UI Elements"

Look down the Tree until you see BackstageItemsPanelElement.

Set BackstageItemsPanelElement.BackColor = 64, 53, 130

Close the Edit UI Elements dialog box and save then Start.  

Open the Backstage and you can see the "Back Button" at the very top still has the blue backcolor (No clue why this object doesnt get it's background from its Parent but it does not) so lets fix the background color for that button.

 

Close the Ap if its still running.  Open the form in VS Designer.  Edit UI Elements.  Look down until you find this:

RootRadElement.BackstageViewElement.BackstageItemsPanelElement.RadButtonElement.FillPrimitive

Set RadButtonElement.FillPrimitive.BackColor = 64, 53, 130

and we have to get the border - found under the RadButtonElement.BorderPrimative.FORECOLOR

Set RadButtonElement.BorderPrimative.ForeColor = 64, 53, 130

Close Element hierarchy editor.  Save and Run.

 

Everything looks great now right!??  Attached image #3 (Second.png)

If you examine form.designer.vb you will see these three lines have been added:

 

This is the BackstageItemsPanelElement.Backcolor we changed:

CType(Me.myBackStage.GetChildAt(0).GetChildAt(2), Telerik.WinControls.UI.BackstageItemsPanelElement).BackColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(53, Byte), Integer), CType(CType(130, Byte), Integer))

 

This is the Back Button's FillPrimitive we changed (NOTE Indexes 0, 2, 0, 0)

CType(Me.myBackStage.GetChildAt(0).GetChildAt(2).GetChildAt(0).GetChildAt(0), Telerik.WinControls.Primitives.FillPrimitive).BackColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(53, Byte), Integer), CType(CType(130, Byte), Integer))

 

And this is the Back Button's BorderPrimitive we changed (NOTE Indexes 0, 2, 0, 2)

CType(Me.myBackStage.GetChildAt(0).GetChildAt(2).GetChildAt(0).GetChildAt(2), Telerik.WinControls.Primitives.BorderPrimitive).ForeColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(53, Byte), Integer), CType(CType(130, Byte), Integer))

 

And now to the CRASH.

Close the ap if still running. 

Open the form in Designer. 

Switch to Backstage. 

Click on the triangle thing again and this time Click on "Add Tab Item"

Save your form.

Close the form (Designer)

Now try to reload the form in the Designer.

 

CRASH!!!

You get a Dialog that i believe the Ribbon is throwing (Or more precisely the Backstage object) that says "Error parsing RadItem:  Children collection index is not valid: 0 - 2 - 0 - 0" - See attached image "Crash.png" - this is followed by another almost identical error dialog box except this one will say "0 - 2 - 0 - 2" 

 

Those three lines i posted above that were added to the form.Designer.vb code the first one is fine and has no issues.  The next two lines however are what's causing the problems (FillPrimitive and BorderPrimitive)

 

Any help anyone can offer would be very very appreciated at this time.  I've spent two days trying to work this out.  If there's no way to fix this can anyone suggest an alternate way for me to change those background colors without altering the Theme? 

 

Cheers all!

 

 

 

 

4 comments
Curtis
Posted on: 07 Sep 2022 20:11

That's perfect, Dess thank you!

 

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 07 Sep 2022 09:41

Hello, Curtis,

I understand that it is much easier to set it at design time. But the serialized information relies on the internal elements hierarchy (at the current moment) which might be changed after versions upgrade in future. Note that the public API is safe enough and it is not expected to cause any errors of this kind.

Thank you for your understanding.

Regards,
Dess | Tech Support Engineer, Principal
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.

Curtis
Posted on: 06 Sep 2022 18:24

As always, you're the best Dess.

Your suggestion is where i was heading but wanted to make one last attempt and seeing if i was doing something incorrectly before proceeding to build the backstage at runtime.  My backstage is gigantic containing Perms setup for all users, Project setup for any of our 3500+ projects and on and on.  Assembling all of that at runtime is not impossible, it's just not as easy as doing it in the designer :)

 

Kindest regards,

Curtis

 

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 05 Sep 2022 08:51

Hello, Curtis,

Following the provided steps, I was able to observe the crash. The attached sample project illustrates the result on my end. I confirm that it is an issue with RadRibbonBar and its Edit UI Elements functionality and how the changes are serialized. 

I have converted this forum thread into a public report. 

You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to specify the style settings at run time: 

        Me.RadRibbonBar1.ApplicationMenuStyle = Telerik.WinControls.UI.ApplicationMenuStyle.BackstageView
        Me.RadRibbonBar1.BackstageControl.BackstageElement.ItemsPanelElement.BackColor = Color.Red
        Me.RadRibbonBar1.BackstageControl.BackstageElement.ItemsPanelElement.BackButtonElement.ButtonFillElement.BackColor = Color.Red
        Me.RadRibbonBar1.BackstageControl.BackstageElement.ItemsPanelElement.BackButtonElement.BorderElement.ForeColor = Color.Red

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.