求教wpf里面MenuItem.Icon属性的问题

求教wpf里面MenuItem.Icon属性的问题,第1张

<MenuItem>

<MenuItem.Icon>

<StackPanel>

<Image Source="/Consolecomponent/Icon/Mini-brightgreen.png"></Image>

</StackPanel>

</MenuItem.Icon>

</MenuItem>

要注意以下几个方面,先后顺序未必正确,有可能多设几次

1.设置ToolBar可以显示文字

ToolBar.ShowCaption

:=

True

2.设置ToolButton大小

ImageList.Width

ImageList.Height

3.设置菜单关联

4.设置运行时显示图标(这个是关键)

ToolButton.Menuitum.ImageIndex

要保证MenuItem所在的MainMenu没有设置Image,否则,Menu中会同时显示Icon


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11640464.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存