【问题标题】:The type 'p:PieMenu' AND 'p:PieMenuItem': was not found. Verify that you are not missing an assembly reference类型“p:PieMenu”和“p:PieMenuItem”:未找到。确认您没有丢失程序集引用
【发布时间】:2014-06-28 03:30:10
【问题描述】:

我尝试使用圆形菜单,但尽管遵循了教程,但仍出现此错误:

这些是我得到的错误:

这是我的代码:

<Window x:Class="GMAO.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:p="clr-namespace:GMAO;assembly=GMAO"
        Title="MatserCom GMAO" Height="479" Width="792" Background="#9DB9EB" >
        <StackPanel Height="331" HorizontalAlignment="Left" Margin="160,56,0,0" Name="stackPanel2" VerticalAlignment="Top" Width="452">
            <Canvas Background="Black">
                <p:PieMenu x:Name="Menu1"  //I have error at this line with p:PieMenu>
                    <p:PieMenuItem Header="Item 1"> //I have error with all lignes that begin with p:PieMenuItem
                        <p:PieMenuItem Header="Item 1.1" Click="PieMenuItem_Click"/>
                        <p:PieMenuItem Header="Item 1.2" Command="NotACommand"/>
                    </p:PieMenuItem>
                    <p:PieMenuItem Header="Item 2">
                        <p:PieMenuItem Header="Item 2.1" />
                    </p:PieMenuItem>
                    <p:PieMenuItem Header="Item 3">
                        <p:PieMenuItem Header="Item 3.1" />
                    </p:PieMenuItem>
                </p:PieMenu>
            </Canvas>
        </StackPanel>

当我尝试运行代码时,这是我得到的错误:

这是 Assemly 项目信息

感谢帮助

【问题讨论】:

  • 我需要帮助请你帮帮我:'(
  • 请检查上下文中的元素是否在程序集 GMAO 中可用并且是公共的并且派生自 UIElement。你可以分享GMAO组件吗?所以我们可以看看
  • 我已经编辑了我的问题 pushpraj :(
  • PieMenu.cs 类的命名空间是什么?
  • 这些用户控件在 GMAO 项目中吗?如果不是,那么您将缺少对包含实际控件的程序集的引用,即 PieMenu。如果这些控件可用,那么即使xmlns:p="clr-namespace:GMAO" 也应该可以工作。如果仍然不起作用,那么您是否可以发布项目的副本,您可以删除任何敏感信息。

标签: wpf xaml wpf-controls menu-items


【解决方案1】:

尝试以这种方式声明 p 前缀:

xmlns:p="clr-namespace:GMAO.PieMenu"

我假设 PieMenuPieMenuItem 在命名空间中声明:GMAO.PieMenu。如果它来自同一个程序集/项目,则不必指定程序集名称。

【讨论】:

  • 感谢 har07,但在 clr-namespace 之后出现新错误,它应该采用命名空间,而 PieMenu 不是命名空间:/
  • 谢谢大家,我刚刚重建并清理了项目,现在它可以工作了,非常感谢@har07 和 pushpraj 的帮助:D
猜你喜欢
  • 2011-08-16
  • 1970-01-01
  • 2011-03-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-09
  • 1970-01-01
相关资源
最近更新 更多