RibbonControlLibrary.dll
Ribbon
.Ribbon
, click the “…” by Tabs. Add a Tab.
Solved the unhandled exception by adding a GroupSizeDefinition
in the RibbonGroup
:
<my:RibbonGroup Name="Group1" HasDialogLauncher="True" Command="{StaticResource Group1Command}"> <my:RibbonGroup.GroupSizeDefinitions> <my:RibbonGroupSizeDefinitionCollection > <my:RibbonGroupSizeDefinition> <my:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True" /> <my:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" /> <my:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" /> <my:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" /> </my:RibbonGroupSizeDefinition> </my:RibbonGroupSizeDefinitionCollection> </my:RibbonGroup.GroupSizeDefinitions> </my:RibbonGroup>
Full Window1.xaml
listing:
<r:RibbonWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" x:Class="RibbonTutorial.Window1" x:Name="Window" Title="Window1" Width="640" Height="480"> <Grid x:Name="LayoutRoot"> <r:Ribbon Title="ezFIT - Prototype (Ribbon UI)" x:Name="ribbon"> <r:Ribbon.Resources> <r:RibbonCommand x:Key="SaveCommand" CanExecute="SaveCommand_CanExecute" Executed="SaveCommand_Executed" LabelTitle="Save" SmallImageSource="images\Clear.png" LargeImageSource="images\Delete.png" ToolTipTitle="Save" ToolTipDescription="Save your work." /> </r:Ribbon.Resources> <r:RibbonTab Label="Patient"> <r:RibbonGroup Name="Group1" HasDialogLauncher="True" Command="{StaticResource SaveCommand}" > <r:RibbonGroup.GroupSizeDefinitions> <r:RibbonGroupSizeDefinitionCollection > <r:RibbonGroupSizeDefinition> <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True" /> <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" /> <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" /> <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" /> </r:RibbonGroupSizeDefinition> </r:RibbonGroupSizeDefinitionCollection> </r:RibbonGroup.GroupSizeDefinitions> </r:RibbonGroup> </r:RibbonTab> <r:RibbonTab Label="Product List"/> <r:RibbonTab Label="Fitting"/> <r:RibbonTab Label="Reports"/> </r:Ribbon> </Grid> </r:RibbonWindow>