无法创建在装配'RibbonControlsLibrary,Version = 3.5.31016.1,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'中定义的'Ribbon'实例.调用的目标已引发异常 [英] 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

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

问题描述

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

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

< UserControl : =""MySample.RibbonUserControl"

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

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

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

< >

< >

< r 丝带 ="NavigationRibbon" Horizo​​ntalAlignment =&qu ot; NavigationRibbon_Loaded" 宽度 =; Auto">

</ : 丝带 </ >

</ >

</ UserControl

我收到此错误,但:

不能创建在程序集'RibbonControlsLibrary,Version = 3.5.31016.1,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'中定义的'Ribbon'实例.调用的目标引发了异常.解决方案

您确实在项目中添加了对RibbonControlsLibrary的引用,对吗?

为什么不使用扩展面板(根据建议):

< DockPanel LastChildFill ="True">
        <!-丝带->
        < ribbon:Ribbon DockPanel.Dock ="Top"标题="{Binding RelativeSource = {RelativeSource AncestorType = {x:Type Window}},Path = Title}"
        </ribbon:Ribbon>

        <!-实际窗口内容->
        <网格>
            <!-您在此处的实际窗口内容->
        </Grid>
    </DockPanel> 


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

解决方案

You did add the reference to the RibbonControlsLibrary in your project, right?

Why don't you use a dockpanel (as recommended):

    <DockPanel LastChildFill="True">
        <!-- Ribbon -->
        <ribbon:Ribbon DockPanel.Dock="Top" Title="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Title}">
        </ribbon:Ribbon>

        <!-- Actual window content -->
        <Grid>
            <!-- Your actual window content here -->
        </Grid>
    </DockPanel>


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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆