Click here to Skip to main content
15,434,964 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using prism for my Project in which i wish to use Ribbon using "RibbonControlsLibrary".

I have a xml file as a resource file, from which the elements are to be loaded in Ribbon.
The hierarchy for items is dependent on ParentID.
If ParentID=0; it should be a RibbonTab. And the other element should be button based on the Parent ID and Item ID.
If Parent ID of element1 matches with the ItemID of element2,then element1 should be a button in the element2's Tab.

when I am trying to do the code, i am able to create Tabs based on the id's. but I am unable to view other elements as buttons.

Can anyone help me out.
Here is the code that i am trying to do.

  <MenuItem MenuID="1" ParentID="0" HeaderText="File" ImagePath=""  CommandParameter="0"/>
   <MenuItem MenuID="5" ParentID="0" HeaderText="Search" ImagePath=""  CommandParameter="0"/>
  <MenuItem MenuID="6" ParentID="0" HeaderText="Help" ImagePath="" CommandParameter="0"/>
  <MenuItem MenuID="11" ParentID="1" HeaderText="New" ImagePath="" CommandParameter="1"/>
  <MenuItem MenuID="12" ParentID="1" HeaderText="Open"  ImagePath=""CommandParameter="0"/>


<UserControl ...
<HierarchicalDataTemplate DataType="{x:Type ViewModels:RibbonMenuBarViewModel}" ItemsSource="{Binding Path=RibBttn}">
                <Style TargetType="Ribbon:RibbonGroup">
                    <Setter Property="Header" Value="{Binding Path=Text}"></Setter>                    
                    <Setter Property="ToolTip" Value="{Binding Path=ToolTip}" />    
                    <Setter Property="Height" Value="75"></Setter>
                    <Setter Property="Width" Value="75"></Setter>
                    <Setter Property="Background" Value="Red"></Setter>
                <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Text}"></TextBlock>               
 <models:RibbonMenuItemViewModelCollection x:Key="RibbonMenu"></models:RibbonMenuItemViewModelCollection>
 <Ribbon:Ribbon ItemsSource="{DynamicResource RibbonMenu}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Stretch"
                           removed="{x:Null}" FontSize="12" FontFamily="Arial">  
Updated 2-Apr-12 1:33am
Charles Shob 30-Jan-13 6:57am     CRLF
Hello, Have you get a chance to resolve this issue??? If so, kindly let me know how you done it. I am also in the same situation as you before. Regards.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900