We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Adding RibbonTabs to Ribbon

Hi,

I'm trying to create a class that is derived from the RibbonTab class. Here is my code:

.XAML
x:Class="TestSyncfusion.TestTab" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Height="300" Width="300">


.XAML.CS
public partial class TestTab : RibbonTab
{
public TestTab()
{
InitializeComponent();
}
}

Now I'm trying to add an instance of this class to my Ribbon. I'm also adding two normal RibbonTabs.

RibbonTab tab1 = new RibbonTab();
tab1.Caption = "Tab1";
this.MyRibbon.Items.Add(tab1);

TestTab tab2 = new TestTab();
tab2.Caption = "Tab2";
this.MyRibbon.Items.Add(tab2);

RibbonTab tab3 = new RibbonTab();
tab3.Caption = "Tab3";
this.MyRibbon.Items.Add(tab3);

As you can see in the image (attachment) there is a space between the first and third tab (here should be my own created tab)!!

Now my question is: Why isn't my own made tab being showed?!

Thanks,

Arjan





Tabs_9af905ff.zip

5 Replies

PP Prabhu P Syncfusion Team April 27, 2009 07:04 PM UTC

Hi Arjan,

Thank you for your interest in Syncfusion products.

The way which you have tried to derive a class from RibbonTab was wrong. We have tried to create a sample by using your code snippet and it’s not working. We wondering that how did you get that snapshot given in attachment. However, we have created a simple sample for demonstrating to create a custom class which is derived from RibbonTab and added the custom class’s element into the Ribbon. Please find the sample from the link given below .

http://files.syncfusion.com/support/tools.WPF/7.2.0.20/80785/main.htm

We hope this sample will fulfill your requirement. Please let me know if you have any other queries.

Thanks,
Prabu




AV Arjan van der Stelt April 28, 2009 07:32 AM UTC

Hi,

Thank you for the fast solution. The solution you gave works. However if I use that solution I have to design my custom tab programmatically. I was hoping I could do this using the designer (.XAML file)?!

In the attachment you will find the project that I made. Here you can see how I tried it.

Thanks,

Arjan



TestApplication_380d36a.zip


MM Michael Matela April 28, 2009 08:03 AM UTC

>Now I'm trying to add an instance of this class to my Ribbon. I'm also adding two normal RibbonTabs
>As you can see in the image (attachment) there is a space between the first and third tab (here should be my own created tab)!!
>Now my question is: Why isn't my own made tab being showed?!

I just did the same thing, with the same problem. Actually, your tab is shown (try adding a Keytip, then you'll be able to switch to it). The "problem" is in your code:

>lt;syncfusion:RibbonTab
x:Class="TestSyncfusion.TestTab" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Height="300" Width="300">
<

Here you are setting the Height and Width to 300, which makes the displayed Tab that big. Into that space the actual tab is drawn at the bottom left position. Simply remove these two properties, and all is fine.

You could argue that the control should ignore the setting or better coerce it to a useful value instead.

Kind regards,
Daniel Rose
EXAPT Systemtechnik GmbH



AV Arjan van der Stelt April 28, 2009 08:28 AM UTC

Hi Daniel,

Thanks for the solution.
It workes great!!

Kind regards,

Arjan



PP Prabhu P Syncfusion Team April 28, 2009 03:56 PM UTC

Hi Arjan,

We are glad to hear that your problem has been resolved. Please let us know if you have any other queries.

Best Regards,
Prabu


>Hi Daniel,

Thanks for the solution.
It workes great!!

Kind regards,

Arjan




Loader.
Live Chat Icon For mobile
Up arrow icon