WPF setting a MenuItem.Icon in code

前端 未结 8 1071
心在旅途
心在旅途 2020-12-08 07:05

I have an images folder with a png in it. I would like to set a MenuItem\'s icon to that png. How do I write this in procedural code?

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 07:29

    You can also use your Visual Studio to insert a icon. This is the easiest way

    • Right click at you project in the solution explorer
    • chose Properties
    • Make sure you're in the application page.
    • @ recources you see: Icon and Manifest
    • @ Icon: Click browse and pick your icon.

    Problem solved.

提交回复
热议问题