字符串到图像 WPF 转换器
如何在 WPF 中编写转换器以在 WPF 中显示四个状态图标,在我的项目中,我计划根据某些条件显示以下四种状态 1) 红点图标 - 未保存的数据 2) 绿点图标 - 保存成功 3) 白点图标或无图标 - 窗口已成功初始化并且没有未保存的数据。 4) 错误图标 - 保存数据时出现错误。
任何帮助将不胜感激,提前致谢。
How to code a converter in WPF to display four status icons in WPF, In my project I am planning to display following four status based on certain conditions
1) Red Dot icon - Unsaved data
2) Green Dot icon - Save successful
3) White Dot icon OR No icon - window has Initialized successfully and there is no unsaved data.
4) Error icon - There were errors while saving data.
Any help would be highly appreciated, thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想更改窗口图标,最简单的方法是创建所有图标并将它们保存为资源,然后更改它:
如果您只想在表单上显示点,您可以绘制一个圆圈并使用 yourCircle.Fill( 更改其颜色) newColor)
此示例来自 msdn:
If you want to change the window icon the simpliest way is to create all icons and save them as resource and then change it with:
If you want just to display dots on your form you draw a circle and change its color with yourCircle.Fill(newColor)
This example is from msdn: