Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 添加RibbonGroup时出现未处理的异常_Wpf_Ribbon_Ribbon Control - Fatal编程技术网

Wpf 添加RibbonGroup时出现未处理的异常

Wpf 添加RibbonGroup时出现未处理的异常,wpf,ribbon,ribbon-control,Wpf,Ribbon,Ribbon Control,我正在尝试在WPF应用程序中实现Outlook功能区,该功能区运行良好。然而,当我尝试添加RibbonGroup时,我在XAML中得到一个未处理的异常 这是我的密码: <r:RibbonWindow x:Class="WpfArticles.Main" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/win

我正在尝试在WPF应用程序中实现Outlook功能区,该功能区运行良好。然而,当我尝试添加RibbonGroup时,我在XAML中得到一个未处理的异常

这是我的密码:

<r:RibbonWindow 
    x:Class="WpfArticles.Main"
    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"
    Title="Main" Height="500" Width="500">

    <StackPanel>
        <r:Ribbon Title="WPF Ribbon - Document1" x:Name="ribbon" >
            <r:RibbonTab Label="Home">
                <r:RibbonGroup Name="Test" />
            </r:RibbonTab>
            <r:RibbonTab Label="Insert"/>
            <r:RibbonTab Label="Help"/>
        </r:Ribbon >
我做错了什么?没有
它就可以正常工作


感谢您的帮助和时间

我怀疑您使用的是旧版本,因为Label属性不再有效。可以找到最新版本。

我下载了该功能区,但由于某些原因无法添加引用。无论如何,我下载了一个例子,它清楚地说,如果它是空的,组将抛出一个异常。所以现在一切正常。谢谢你的帮助

Object reference not set to an instance of an object. at
Microsoft.Windows.Controls.Ribbon.RibbonGroup.OnApplyTemplate() at
System.Windows.FrameworkElement.ApplyTemplate() at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at
Microsoft.Windows.Controls.Ribbon.RibbonGroupsContainer.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Border.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Control.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Control.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Decorator.MeasureOverride(Size constraint) at
System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Border.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Border.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.DockPanel.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Border.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Control.MeasureOverride(Size constraint) at
MS.Internal.WindowControl.DesignTimeWindow.MeasureOverride(Size availableSize) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Designer.SimpleViewManager.DesignerBackground.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Decorator.MeasureOverride(Size constraint) at
Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Controls.Control.MeasureOverride(Size constraint) at
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
System.Windows.UIElement.Measure(Size availableSize) at
System.Windows.Interop.HwndSource.SetLayoutSize() at
System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at
System.Windows.Interop.HwndSource.set_RootVisual(Visual value) at
MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize() at
MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content) at
MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle() at
MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle() at
MS.Internal.Designer.DesignerPane.LoadDesignerView()