Silverlight ContextMenu was not found

妖精的绣舞 提交于 2019-12-11 04:02:41

问题


This is what I've got inside a Canvas tag right now. I've been trying to get a right click menu working for ages.

<controlsInputToolkit:ContextMenuService.ContextMenu>
   <controlsInputToolkit:ContextMenu>
      <controlsInputToolkit:MenuItem Header="Move Up" Click="MoveUp_Click">
         <controlsInputToolkit:MenuItem.Icon>
            <Rectangle Width="16" Height="16" Fill="{StaticResource MoveUpBrush}"/>
         </controlsInputToolkit:MenuItem.Icon>
      </controlsInputToolkit:MenuItem>
      <controlsInputToolkit:MenuItem Header="Move Down" Click="MoveDown_Click">
         <controlsInputToolkit:MenuItem.Icon>
            <Rectangle Width="16" Height="16" Fill="{StaticResource MoveDownBrush}"/>
         </controlsInputToolkit:MenuItem.Icon>
      </controlsInputToolkit:MenuItem>
      <controlsInputToolkit:Separator/>
         <controlsInputToolkit:MenuItem Header="Delete" Click="Delete_Click">
            <controlsInputToolkit:MenuItem.Icon>
               <Rectangle Width="16" Height="16" Fill="{StaticResource DeleteBrush}"/>
            </controlsInputToolkit:MenuItem.Icon>
         </controlsInputToolkit:MenuItem>
      </controlsInputToolkit:ContextMenu>
   </controlsInputToolkit:ContextMenuService.ContextMenu>

I've just coped that code from: http://www.silverlight.net/content/samples/sl4/toolkitcontrolsamples/run/default.html

The error I'm getting is:

"The attachable property 'ContextMenu' was not found in type 'ContextMenuService'."

"The type 'controlsInputToolkit:ContextMenu' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been build."

And a whole bunch of others like that. The only clue I've found to solve this problem had something to do with maybe the toolkit wasn't referencing the right version of Silverlight?

Because I did have only Silverlight 3, and then I downloaded the stuff for Silverlight 5 I think, and that's what my project is in. Except I have no idea how to see what the Toolkit's actually referencing, or how to change that.


回答1:


Hi You have to give reference of following dll.

 System.Windows.Controls.Input.dll
 System.Windows.Controls.Toolkit.dll
 System.Windows.Controls.Input.Toolkit.dll


来源:https://stackoverflow.com/questions/9811221/silverlight-contextmenu-was-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!