2011-03-25 3 views
1

WPF 응용 프로그램에서 Outlook 리본을 구현하려고하는데 리본이 제대로 작동합니다. 그러나 RibbonGroup을 추가하려고하면 XAML에서 처리되지 않은 예외가 발생합니다. 여기 RibbonGroup을 추가 할 때 처리되지 않은 예외가 발생했습니다.

내 코드입니다 :

<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 > 

그리고 내가 XAML에서이 오류를 얻고있다 :

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() 

내가 잘못 뭐하는 거지? <r:RibbonGroup Name="Test" />이 없으면 정상적으로 작동합니다! 여러분의 도움과 시간

답변

0

해당 리본을 다운로드했지만 어떤 이유로 든 참조를 추가 할 수 없습니다. 어쨌든, 예제를 다운로드했고 그룹이 비어 있으면 그룹이 예외를 던질 것이라고 분명하게 말했습니다. 이제는 모든 것이 잘 작동합니다. 당신의 도움을 주셔서 감사합니다!

0

에 대한

덕분에 나는 레이블 속성이 더 이상 유효대로 이전 버전을 사용하지 않습니다 생각한다. 최신 버전은 here입니다.