Subclassing RadRibbonTab

5 posts, 0 answers
  1. Christian
    Christian avatar
    2 posts
    Member since:
    Sep 2012

    Posted 21 Aug 2013 Link to this post

    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.

  2. Christian
    Christian avatar
    2 posts
    Member since:
    Sep 2012

    Posted 21 Aug 2013 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 21 Aug 2013 Link to this post

    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 >>
  5. Stalin
    Stalin avatar
    1 posts
    Member since:
    Oct 2012

    Posted 15 Sep 2013 Link to this post

    the subclassed RibbonTab not seen in design view. why?
  6. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 18 Sep 2013 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready