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

RadRibbonWindow inside User control

6 Answers 202 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Madhu
Top achievements
Rank 1
Madhu asked on 09 Sep 2013, 06:19 PM
Hi,

I am trying to use RadRibbonView inside my user control.
And since RadRibbonView does not work unless we include RadRibbonWindow, I have tried to add it to my User control.

It is always giving exception.
"Set property 'System.Windows.Controls.ContentControl.Content' threw an exception.' Line number '6' and line position '14'."

Here is my Code:(XAML:)

<UserControl x:Class="TestTelerikRibbonApp.UserControlTab1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             Name="UCTestTab1"
             mc:Ignorable="d" 
             d:DesignHeight="330" d:DesignWidth="488">    
    
    <telerik:RadRibbonWindow>
        <telerik:RadRibbonView x:Name="rbvTest">
            <telerik:RadRibbonTab Header="RadRibbon" HorizontalAlignment="Left" Margin="0,0,0,0" Name="radRibbonTab" VerticalAlignment="Top">               
                <telerik:RadRibbonGroup Header="Home" Name="rgHome">
                </telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
    </telerik:RadRibbonWindow>
</UserControl>

6 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 10 Sep 2013, 01:59 AM
Hello,

The exception that you get is caused by the fact that the RadRibbonWindow derives from the native Window class. However a Window must be the root of the tree and it cannot be added as a child of Visual.

So if you want to use a RibbonWindow you need to make sure to define it as a root of a tree as you would use a native Window object:
<telerik:RadRibbonWindow x:Class="WpfApplication2.MyRibbonWindow"
             ...>
        <telerik:RadRibbonView x:Name="rbvTest">
            <telerik:RadRibbonTab Header="RadRibbon"
                                  HorizontalAlignment="Left"
                                  Margin="0,0,0,0"
                                  Name="radRibbonTab"
                                  VerticalAlignment="Top">
                <telerik:RadRibbonGroup Header="Home"
                              Name="rgHome">            
                       </
telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
</telerik:RadRibbonWindow>

Also please have in mind that the main purpose of the RibbonWindow is to provide you with a more fluent UI when hosting the RibbonView in a window as the RibbonView title, layout and style is synchronized with the RibbonWindow. But that does not necessarily mean that you need to use the RibbonView in a RibbonWindow.

And if you have encountered any issues using the RibbonView outside a RibbonWindow, please let us know so that we can address them accordingly.

Regards,
Tina Stancheva
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
Madhu
Top achievements
Rank 1
answered on 10 Sep 2013, 01:26 PM
Hi Tina,

I understand that RibbonWindow need to be defined as a root of a tree as you would use a native Window object.

But my problem is i dont want to change my Main window to telerik:RadRibbonWindow

I am having Mainwindow which has number of User Controls which will be used apart from the usercontrol(TestTelerikRibbonApp.UserControlTab1which i am creating.

So, i cant change my Main window to RadRibbonWindow because there are other user controls(which are not using telerik controls)
accessing that main window.

So i wanted to create a User Control which contains a RadRibbonView.
But when i am trying to use just RadRibbonView, i am getting exception.

<UserContol x:Class="TestTelerikRibbonApp.UserControlTab1
"
             ...>
        <telerik:RadRibbonView x:Name="rbvTest">
            <telerik:RadRibbonTab Header="RadRibbon"
                                  HorizontalAlignment="Left"
                                  Margin="0,0,0,0"
                                  Name="radRibbonTab"
                                  VerticalAlignment="Top">
                <telerik:RadRibbonGroup Header="Home"
                              Name="rgHome">             
                       </
telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
</UserControl>



So i tried to wrap RadRibbonView within RadRibbonWindow.
Please let me know how to proceed.

Thanks,
Madhu

0
Tina Stancheva
Telerik team
answered on 10 Sep 2013, 10:30 PM
Hello Madhu,

I was not able to detect any issues with the approach you essentially need to implement. I can successfully add a RibbonView in a UserControl and then add it in the MainWindow of the application. Please have a look at the attached sample and let me know if there is something I am missing.

Regards,
Tina Stancheva
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
Madhu
Top achievements
Rank 1
answered on 11 Sep 2013, 02:20 PM
Anyone, please help me.
0
Tina Stancheva
Telerik team
answered on 11 Sep 2013, 02:57 PM
Hello Madhu,

Can you please elaborate a bit more on the issue you're experiencing? In my previous post I attached a sample project to demonstrate how to put the RadRibbonView in an UserControl and then place it in a Window. Can you please have a look at the solution and let me know if it works for you?

Also, if you feel that there is something I'm missing, please modify the solution accordingly. This would help me better understand the issue you're experiencing and advice you how to get over it.

Regards,
Tina Stancheva
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
Madhu
Top achievements
Rank 1
answered on 12 Sep 2013, 01:15 PM
Hi Tina,

Earlier, i did get an error forcing me to include RadRibbonWindow to wrap around RadRibbonView.
But it is working fine right now without any modifications. I am not able to reproduce the error.

Anyways,Thanks for your Help.

Regards,
Madhu
Tags
RibbonView and RibbonWindow
Asked by
Madhu
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Madhu
Top achievements
Rank 1
Share this question
or