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

Add radribbontab, radribbongroup, radorderedwrap panel in code behind

4 Answers 285 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 12 Mar 2012, 01:57 PM
I have a page based wpf application, where a user enters information and clicks on a "Next" button, and is brought to a new page, passing the information along.  When the second page is reached, I want to dynamically add tab(s), group(s), and wrappanel(s), based on how many inputs they submitted.  I am trying the following, but it is exceptioning out with the following error:

Layout measurement override of element 'Telerik.Windows.Controls.RibbonView.Primitives.RibbonGroupsPanel' should not return PositiveInfinity as its DesiredSize, even if Infinity is passed in as available size.

Code:
             RadOrderedWrapPanel checkpointwrap = new RadOrderedWrapPanel();
            checkpointwrap.Name = "ckwrap";

            RadRibbonGroup checkpointgroup = new RadRibbonGroup();
            checkpointgroup.Name = "ckp_" + "2";
            checkpointgroup.Items.Add(checkpointwrap);
            checkpointgroup.Header = "GroupTest";

            RadRibbonTab checkpointtab = new RadRibbonTab();
            checkpointtab.Name = "CKP1";
            checkpointtab.Items.Add(checkpointgroup);

            this.Grid1.Children.Add(checkpointtab);

4 Answers, 1 is accepted

Sort by
0
Ken
Top achievements
Rank 1
answered on 12 Mar 2012, 07:20 PM
Found the issue.  Instead of adding to my Grid, I just needed to add the tab to the ribbonview:

this.radRibbonView.Children.Add(checkpointtab);

Tabs/Groups/Wrappanels are now built dynamically
0
Miro Miroslavov
Telerik team
answered on 14 Mar 2012, 09:04 AM
Hello Ken,

 Yes, you need to add the Tabs to the Ribbon. Please let us know if you have other issues. 

All the best,
Miro Miroslavov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Marcello
Top achievements
Rank 1
Iron
answered on 02 Aug 2013, 11:28 AM
Hi,

with last version of controls (2013 Q2) RadRibbonView don't contain a Children properties.
How to add dinamically, in codebihind, a new tab to a RadRibbonView?

Thank's,
marc.
0
Pavel R. Pavlov
Telerik team
answered on 07 Aug 2013, 11:21 AM
Hi Marcello,

You are right that there is no Children collection exposed by the RadRibbonView control in our latest official release. However, in order to add/remove RadRibbonTabItems at runtime you can use a HierarchicalDataTemplates. The required structure of the hierarchy is the following:
RadRibbonView -> RadRibbonTab -> RadRibbonGroup -> other RadRibbon controls. Hence, you need to implement hierarchy matching this structure. You can take a look at this demo to see how we implemented this structure.

I hope this information will help you. Don't hesitate to ask if you have any other questions.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RibbonView and RibbonWindow
Asked by
Ken
Top achievements
Rank 1
Answers by
Ken
Top achievements
Rank 1
Miro Miroslavov
Telerik team
Marcello
Top achievements
Rank 1
Iron
Pavel R. Pavlov
Telerik team
Share this question
or