Silverlight ContextMenu was not found

2019-07-09 11:39发布

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条回答
【Aperson】
2楼-- · 2019-07-09 12:18

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
查看更多
登录 后发表回答