We have a existing project that uses some older telerik libraries.
This application uses the RadRibbonView inside of an ElementHost control. It works great with the older telerik libraries.
I upgraded to the latest 2015 Q3 binaries and I am having problems.
The ribbon no longer displays in the element host.
I did some sanity checks by putting other telerik components into the element host, and they display fine.
Attached is a simple project that reproduces the issue.
Basically it creates a usercontrol.
Adds a simple ribbonview
Adds this ribbon view to a win forms control via element host.
Link to the project:
https://goo.gl/vJv5BG
2 Answers, 1 is accepted
Some more information.
It looks like that last version that it may have worked is: 2012_3_1129. In the 2013 binaries it stops working inside the element host.
The RadRibbonView have a build in logic to become collapsed when the size of the application get really small. In your application the WPF host element have very small size and that is why the RadRibbonView is collapsed and you cant see it. You can change that default behavior by setting the CollapseThresholdSize="0 0" property of the RadRibbonView to "0 0" (width and height). Doing so the RadRibbonView will be visible even the application get really small.
I hope this information helps.
Kind regards,
Kiril Vandov
Telerik
Hello,
I am in a very similar situation. We have several products that use the Telerik WPF Ribbon within a Windows Forms Application and we use the ElementHost to make that work. Everything looks good there.
We are in the process of migrating to .NET 6 which requires us to upgrade the version of Telerik that we use. When I try to use the latest, the ribbon does not render. I tried using the tip here, setting CollapseThreadholdSize to 0, 0 but it makes no difference. At the moment I am trying this in a test application. I was able to get a standard WPF Textbox to appear without a problem so I am fairly certain the issue is with the Ribbon.
Any help here would be tremendously grateful.
Kris Culin
I will guess that the upgraded Telerik dlls are NoXaml. If that is the case, then you can check the following article: Missing Controls in the UI | Telerik UI for WPF
Hi Martin,
That was exactly it. Once I switched my references to us the Xaml version, it worked.
There are two additional problems now that I have the ribbon shown.
The backstage doesn't open and the little drop-down for the QAT doesn't sow our additional buttons that we offer for the use to show or hide. Haven't been able to figure either one out, so far.
If I need to log a separate help item, I can do that.
Thanks,
Kris
Hi Martin,
Let me see what I can do. It may take some time to extract out the pertinent parts of the code and then reproduce the issue and provide you enough context to figure it out.
In the meantime, it seems that the application menu button is being pressed - you can see the color kind of change for a moment like it wants to open. The Load event never gets fired for the Backstage object since we have a handler for that. This is an important event for us because we need to adjust the size of the ElementHost since up to that point it is only showing the ribbon and we need to expand it to "full screen" (we also hide the System.Windows.Forms.Panel that we use for our Windows Forms controls).
If I set the property so the application menu is open on startup, I get the attached image. The color is all wrong. But on the bright side, all the stuff we "want" there is there. It just doesn't open when you hit the menu bar (File) and the back button doesn't work either.
Hopefully this is enough information to give me a lead on where to look. In the meantime, I'll try to put something together that you can debug. It may take a day.
Kris
Hi Martin,
I've attached a prototype solution. One project hosts the WPF RibbonView in an ElementHost and the other project is the opposite (hosting the WinForms label).
With the WinForms version, clicking the File button doesn't do anything. The Load event for the Backstage is never triggered. If this can work, then our handler should set the size of the ElementHost appropriately
Our products currently host the WPF RibbonView in an ElementHost. We've done this for nearly 10 years now and it has worked pretty well. The upgrade has thrown me for a bit of a loop as some of the behaviors don't work as expected.
So with this prototype - File menu which should open the backstage and the QAT which should list some additional commands you can add when the drop-down opens.
I think everything else is working pretty good.
If you have any questions, let me know.
Kris
Hi Martin,
I appreciate you taking a look at the sample. I will need to discuss this request with my manager as it would require providing you (production) source code that we compile into our products. I hope you understand where I am coming from on that.
I'll hopefully know something today but it might be next week (considering it is Friday).
Kris
Hi Martin,
I apologize for the long delay. I finally got approval from my manager to provide the code you requested to make it easier to debug and hopefully help us figure out what is going on.
Please find attached an updated zip file. Everything you need should be included.
If you have any questions, please let me know. I am really hoping you find that only a few lines of code need to be tweaked to get things working.
It's the Haestad.WPFRibbonPrototype project that we need to get working and then we can apply the necessary changes to our production code.
Kind Regards,
Kris
Thank you for the project. I was able to run it and reproduced the issue. The backstage opens, but for some reason the adorner that hosts it doesn't display. I have tested this against our development environment and the issue doesn't occur there. It seems that we have fixed that yesterday. Talking about luck.
The fix is going to be live with our official SP release next week (around the middle). Can you please wait few more days and test the new release.
Hi Martin,
What incredible timing. Waiting until next week is not a problem. I am so pleased this was fixed. I'll keep an eye out for an announcement.
I appreciate the quick turnaround and response.
Kind Regards,
Kris Culin
Hi Martin,
There is one other thing. I noticed in my sample project that I uploaded that the QAT customization wasn't working. It wasn't listing the available commands one could add to the QAT. Could you take a moment and look into that?
The backstage issue (which appears to be fixed with the SP this week) and the QAT issue I think are the last two pieces for us to get our products working in .NET 6 using the latest Telerik WPF Ribbon.
Thanks!
Kris Culin
The drop down button next to the QAT opens few additional options related to the menu and the ribbon, but it doesn't contain any QAT buttons. I could see that one button is missing in your demo and this is because its Visibility is set to Collapsed in the method that creates the button (AddQuickAccessToolbarButton in the TelerikWPFRibbonBuilder.cs file). This happens because the IsVisible of the associated RibbonUIElementBase implementation is set to False. This happens in the Read method of the RibbonUIElementBase class. I don't have access to this storage code, because it is defined in the Haestad.Support assembly, but I guess this information should help you to proceed further and resolve the issue with the missing buttons.
Hi Martin,
Sorry for the delay in response. It's been really busy here at the office with some higher priority projects just finishing up.
First, the update your mentioned fixes the backstage when the RadRibbonView is hosted on a System.Windows.Forms.Form. That is definitely working.
As for the QAT issue I mentioned, I took another look at the code.
Can you please take a look at the QuickAccessToolBar_Loaded event handler in TelerikWPFRibbonBuilder.cs (line 113). There is where our code is populating the QAT.
The problem I'm seeing in the debugger is that dropDownButton.DropDownContent is *not* a StackPanel. As a result, dropDownContent is null so nothing is added to the menu.
DropDownContent is however a RadMenuGroupItem. The first item in this list is a RadGroupHeader. it appears things changed a little bit since the v2016 version of the RadRibbonView (which this code is based on).
Any thoughts on how I should approach this? Feel free to provide a link to another posting or sample. Just need to get an idea of what to do.
TIA,
Kris
Hi Kris, no worries about the delay. As for the DropDownContent, we usually avoid changes in the templates of the Telerik controls, but from time to time this is needed. Also, the structures in the templates may vary per the different themes, so you may need to keep this in mind for further customizations similar to this one.
To resolve the issue, you can replace the StackPanel type with RadMenuGroupItem. This is an ItemsControl implementation, so instead of Children, you can use its Items collection. So, the changes in your code will be minimal. Basically, you change StackPanel to RadMenuGroupItem in all the related methods, and replace the Children property call with Items. For example:
private void AddQATMenuGroupHeader(RadMenuGroupItem dropDownContent, RadGroupHeader groupHeader) { if (groupHeader != null) dropDownContent.Items.Add(groupHeader); }