I am getting an error for the Ribbon controls library, when this errors it breaks at the new() method in the class that is using the ribbon controls.
An exception of type 'System.TypeInitializationException' occurred in WpfPluggableApp.exe but was not handled in user code
Additional information: The type initializer for 'Microsoft.Windows.Controls.Ribbon.RibbonWindow' threw an exception.
But when I continue I get this error instead
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'The invocation of the constructor on type 'WpfPluggableApp.MainWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '5'.
There is nothing I can see which is going to effect it at line 3 of the MainWindow.Xaml:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<DockPanel>
<Menu Name="mnu" DockPanel.Dock="Top">
</Menu>
<TabControl ItemsSource="{Binding Path=ViewModels}">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="IsSelected" Value="{Binding Path=isSelected,Mode=TwoWay}"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<DockPanel MinWidth="120">
<Button
Command="{Binding Path=CloseCommand}"
Content="X"
Cursor="Hand"
DockPanel.Dock="Right"
Focusable="False"
FontFamily="Courier"
FontSize="9"
FontWeight="Bold"
Margin="0,1,0,0"
Padding="0"
VerticalContentAlignment="Center"
Width="16" Height="16"
IsTabStop="False"
/>
<ContentPresenter Margin="10"
Content="{Binding Path=DisplayName}"
VerticalAlignment="Center"
/>
</DockPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Content" Value="{Binding}" />
</Style>
</TabControl.ItemContainerStyle>
</TabControl>
</DockPanel>
Here is the xaml for the ribbon:
<ribbon:RibbonWindow x:Class="MainRibbonWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
Title="MainRibbonWindow"
x:Name="MainRibbonWindow"
WindowState="Maximized" MinHeight="480" MinWidth="640">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ribbon:Ribbon x:Name="Ribbon">
</ribbon:Ribbon>
<TabControl Grid.Row="1" ItemsSource="{Binding Path=ViewModels}">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="IsSelected" Value="{Binding Path=isSelected,Mode=TwoWay}"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<DockPanel MinWidth="120">
<Button
Command="{Binding Path=CloseCommand}"
Content="X"
Cursor="Hand"
DockPanel.Dock="Right"
Focusable="False"
FontFamily="Courier"
FontSize="9"
FontWeight="Bold"
Margin="0,1,0,0"
Padding="0"
VerticalContentAlignment="Center"
Width="16" Height="16"
IsTabStop="False"
/>
<ContentPresenter
Content="{Binding Path=DisplayName}"
VerticalAlignment="Center"
/>
</DockPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<!--<Setter Property="Content" Value="{Binding}" />-->
</Style>
</TabControl.ItemContainerStyle>
</TabControl>
</Grid>
It might be a case of needing a fresh pair of eyes to look at it! If you can see the problem let me know.
Thanks, Sam
-----------------------EDIT-----------------------------------------
Issue has been resolved, I was referencing the wrong class library.