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

Multiple RadRibbonTabs in single View

3 Answers 105 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Rishabh
Top achievements
Rank 1
Rishabh asked on 08 May 2012, 11:02 AM
Hi,


Is it possible to inject multiple RadRibbonTabs contained in a single View, where the region is a RadRibbonView?


All the examples that I have checked out have had a single RadRibbonTab being injected from each view. Whereas what I want is to be able to inject multiple tabs from a single view.


What I tried to do(and it didn't work):
<UserControl x:Class="Module1.Views.Module1View"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <telerik:RadRibbonTab x:Name="tab1" Header="Tab 1">
        </telerik:RadRibbonTab>
        <telerik:RadRibbonTab x:Name="tab2" Grid.Column="1" Header="Tab 2">
        </telerik:RadRibbonTab>
    </Grid>
</UserControl>

I tried to inject this view into the RadRibbonBar region - 'RibbonRegion':
<telerik:RadRibbonView regions:RegionManager.RegionName="RibbonRegion"/>

But resultant effect is not what is required. The attached file 'screen1.png' shows the result of the above code.

I had also tried to inject a control of type RibbonTabStripPanel containing more than one RadRibbonTab, but still the result was that the RibbonTabStripPanel was being added to a RadRibbonTab which is automatically generated.

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 11 May 2012, 09:24 AM
Hello Rishabh,

That's the expected behavior of the RibbonView control. It's important to note that the RibbonView control is an ItemsControl so in a PRISM scenario, it expects each view to represent one item that has to be injected in its Items collection. And this is why when you inject your view of type UserControl, the RibbonView creates a container of type RadRibbonTab and wraps the view in that container.

If you need to modify this default behavior, you can create a custom RegionAdapter for the RibbonView control. The RegionAdapter in a PRISM scenario is responsible for creating a region and associating it to the control. It also controls how the injected views in the region will be visualized in it. So by creating a custom region adapter, you'll be able to get the view, look through its content and insert each RadRibbonTab control it contains in the RibbonView.Items collection. If you decide to use this approach and you need help in implementing it, please let us know.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Siddharth
Top achievements
Rank 1
answered on 19 Nov 2012, 12:20 PM
HI Guys !
I need to load different radRibbonTabs each coming from a different usercontrol. I am not using prism.
Please Help.
0
Tina Stancheva
Telerik team
answered on 22 Nov 2012, 10:50 AM
Hi Siddharth,

I am not sure how is your application set up and what you mean by stating that each RibbonTab comes from a different UserControl. However, if you've created new UserControls in your application that derive from the RadRibbonTab class, you can definitely use them when defining the tabs in the RibbonView control.

Basically if you have a UserControl:
<telerik:RadRibbonTab x:Class="SilverlightApplication2.UserControl1"
          ...
          xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
          Header="Tab 1">
        <telerik:RadRibbonGroup Header="Group 1" />
        <telerik:RadRibbonGroup Header="Group 2" />
</telerik:RadRibbonTab>
public partial class UserControl1 : RadRibbonTab
{
    public UserControl1()
    {
        InitializeComponent();
    }
}

Then you can use this UserControl inside your RibbonView definition:
<telerik:RadRibbonView>
    <local:UserControl1 />
</telerik:RadRibbonView>

If that isn't what you had in mind, please elaborate on your scenario so that we can further assist you in implementing it.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RibbonView and RibbonWindow
Asked by
Rishabh
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Siddharth
Top achievements
Rank 1
Share this question
or