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.
MenuItems.xml
<MenuItems>
<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"/>
</MenuItems>
MenuBarView.xaml
<UserControl ...
xmlns:models="clr-namespace:Models"
xmlns:ViewModels="clr-namespace:ViewModels"
xmlns:Ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary">
<HierarchicalDataTemplate DataType="{x:Type ViewModels:RibbonMenuBarViewModel}" ItemsSource="{Binding Path=RibBttn}">
<HierarchicalDataTemplate.ItemContainerStyle>
<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>
</Style>
</HierarchicalDataTemplate.ItemContainerStyle>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Text}"></TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
<UserControl.Resources>
<models:RibbonMenuItemViewModelCollection x:Key="RibbonMenu"></models:RibbonMenuItemViewModelCollection>
</UserControl.Resources>
<Grid>
<Ribbon:Ribbon ItemsSource="{DynamicResource RibbonMenu}" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Stretch"
removed="{x:Null}" FontSize="12" FontFamily="Arial">
</Ribbon:Ribbon>
</Grid>
</UserControl>