StackPanel 弹出菜单 ContextMenu

<StackPanel x:Name="stackpanel_zonghe"  Margin="0,10,0,0" Background="Transparent" Orientation="Horizontal">
         <StackPanel.ContextMenu>
               <ContextMenu StaysOpen="True">
                      <MenuItem Name="addModule" Header="添加模块" >
                              <MenuItem.Icon>
                                     <Image Source="Resources\add.png" Width="20" Height="20"/>
                              </MenuItem.Icon>
                        </MenuItem>
                  </ContextMenu>
          </StackPanel.ContextMenu>
</StackPanel>
 
注意一定需要将背景设置为透明  否则弹出的右键菜单看不见 Background="Transparent"

posted on 2013-06-29 10:29  838603796  阅读(444)  评论(0编辑  收藏  举报

导航