Wpf Microsoft功能区窗口引发了异常
我得到了Ribbon控件库的一个错误,当这个错误发生时,它在使用Ribbon控件的类中的new()方法处中断 WpfPluggableApp.exe中发生“System.TypeInitializationException”类型的异常,但未在用户代码中处理 其他信息:“Microsoft.Windows.Controls.Ribbon.RibbonWindow”的类型初始值设定项引发异常 但是当我继续的时候,我得到了这个错误 PresentationFramework.dll中发生类型为“System.Windows.Markup.XamlParseException”的未处理异常 其他信息:“对与指定绑定约束匹配的类型“WpfPluggableApp.MainWindow”调用构造函数时引发异常。“行号“3”和行位置“5” 在主窗口的第3行,我看不到任何会影响它的内容。Xaml:Wpf Microsoft功能区窗口引发了异常,wpf,vb.net,xaml,Wpf,Vb.net,Xaml,我得到了Ribbon控件库的一个错误,当这个错误发生时,它在使用Ribbon控件的类中的new()方法处中断 WpfPluggableApp.exe中发生“System.TypeInitializationException”类型的异常,但未在用户代码中处理 其他信息:“Microsoft.Windows.Controls.Ribbon.RibbonWindow”的类型初始值设定项引发异常 但是当我继续的时候,我得到了这个错误 PresentationFramework.dll中发生类型为“Sy
<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>
以下是功能区的xaml:
<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>
这可能需要一双新的眼睛来观察它!如果你能看到问题,请告诉我
谢谢,
萨姆
-----------------------编辑-----------------------------------------
问题已解决,我引用了错误的类库。抱歉,我已将其排序。有一个类库的错误版本,导致它出错