WPF menu item with image

前端 未结 3 688
死守一世寂寞
死守一世寂寞 2021-01-01 08:23

How to define MenuItem.Icon so that the MenuItem

3条回答
  •  再見小時候
    2021-01-01 08:54

    The easy way way is to not use the Icon property but to instead put the icon in the Header:

    
      
        
          
            
            
          
        
      
      
      
    
    

    For this simple case the can be replaced with a because that's what ContentPresenter would use to present the string anyway. For more complex Header=, you could use the ContentPresenter as shown.

提交回复
热议问题