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

Subclassing RadRibbonTab

4 Answers 122 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 21 Aug 2013, 02:44 PM
I'm trying to subclass the RadRibbonTab as a custom UserControl to be able to use PRISM to navigate to a specific ribbon tab.

However the subclassed RibbonTab never appears in the tab bar of the ribbon. I created a sample to demonstrate the problem:

MainWindow.xaml:

<Window x:Class="RadControlsWpfApp1.MainWindow"
                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"
        xmlns:local="clr-namespace:RadControlsWpfApp1"
                Title="MainWindow" Height="350" Width="525">
    <telerik:RadRibbonView>
        <telerik:RadRibbonTab Header="Tab 1">
            <telerik:RadRibbonGroup Header="Group 1">
                <telerik:RadRibbonButton Size="Large">Button 1</telerik:RadRibbonButton>
            </telerik:RadRibbonGroup>
        </telerik:RadRibbonTab>
        <local:UserControl1 />
    </telerik:RadRibbonView>
</Window>

UserControl1.xaml:

<telerik:RadRibbonTab x:Class="RadControlsWpfApp1.UserControl1"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300"
                      Header="Tab 2">
    <telerik:RadRibbonGroup Header="Group 2">
        <telerik:RadRibbonButton Size="Large">Button 2</telerik:RadRibbonButton>
    </telerik:RadRibbonGroup>
</telerik:RadRibbonTab>

UserControl1.xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
 
namespace RadControlsWpfApp1
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : RadRibbonTab
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
}

I'm probably missing something obvious, however I don't know what. Thanks for your help.

4 Answers, 1 is accepted

Sort by
0
Christian
Top achievements
Rank 1
answered on 21 Aug 2013, 03:32 PM
Just found out the following: It works when not using implicit styling.

And the solution: Add Style="{StaticResource ResourceKey=RadRibbonTabStyle}" to the subclassed RadRibbonTab. Sorry for the noise.
0
Kiril Vandov
Telerik team
answered on 21 Aug 2013, 03:38 PM
Hello Christian,

We are aware of this issue and you could track its progress here. However as a workaround you could set the RadRibbonTab Style property to its default value, like follows:
<telerik:RadRibbonTab x:Class="TestApplication.RibbonTab1"
      Style="{StaticResource RadRibbonTabStyle}"
...

Please excuse us for any inconvenience caused. I hope this information helps.

Regards,
Kiril Vandov
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 >>
0
Stalin
Top achievements
Rank 1
answered on 16 Sep 2013, 01:43 AM
the subclassed RibbonTab not seen in design view. why?
0
Kiril Vandov
Telerik team
answered on 18 Sep 2013, 11:50 AM
Hello Stalin Vladimir,

The RadRibbonTab will only displays its Header in the designer as the RadRibbonTab derives from a HeaderedItemsControl. You can examine the same behavior if you set a TabItem as a root of a UserControl.

Kind regards,
Kiril Vandov
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
Christian
Top achievements
Rank 1
Answers by
Christian
Top achievements
Rank 1
Kiril Vandov
Telerik team
Stalin
Top achievements
Rank 1
Share this question
or