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"
相關文章
相關標籤/搜索