本文介绍了无法创建在装配'RibbonControlsLibrary,Version = 3.5.31016.1,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'中定义的'Ribbon'实例.调用的目标已引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Office Ribbon并添加了 RibbonControlsLibrary RibbonControl. (这些dll的位置在我的本地位置中)

我的xaml代码包含以下内容:

< UserControl x : Class =""MySample.RibbonUserControl"

xmlns =&; http://schemas.microsoft.com/winfx/2006/xaml/presentation";

xmlns : r ="clr-namespace:Microsoft.Windows.Controls.Ribbon; assembly = RibbonControlsLibrary""

xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml>

< 网格 >

span> < 画布 >

< r : 丝带 名称 ="NavigationRibbon" Horizo​​ntalAlignment ="Center" 已加载 =&qu ot; NavigationRibbon_Loaded" 宽度 =自动" 高度 =; Auto">

span> </ r : 丝带 >

span> </ 画布 >

</ 网格 >

</ UserControl >

我收到此错误,但:

不能创建在程序集'RibbonControlsLibrary,Version = 3.5.31016.1,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'中定义的'Ribbon'实例.调用的目标引发了异常. 标记文件中对象'System.Windows.Controls.Canvas'的错误

解决方案


I installed Office Ribbon and added reference of RibbonControlsLibrary and RibbonControl. (The location of these dlls is somewhere in my local)

 

My xaml code contains this :

 

<UserControl x:Class="MySample.RibbonUserControl"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

             xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

 

    <Grid>

        <Canvas >

            <r:Ribbon Name="NavigationRibbon" HorizontalAlignment="Center" Loaded="NavigationRibbon_Loaded" Width="Auto" Height="Auto">

            </r:Ribbon>

        </Canvas>

    </Grid>

</UserControl>

 

I get this error but :

 

Cannot create instance of 'Ribbon' defined in assembly 'RibbonControlsLibrary, Version=3.5.31016.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Exception has been thrown by the target of an invocation.  Error at object 'System.Windows.Controls.Canvas' in markup file

解决方案


这篇关于无法创建在装配'RibbonControlsLibrary,Version = 3.5.31016.1,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'中定义的'Ribbon'实例.调用的目标已引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 00:36