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"
做几年有理想的人