列表框:更改某些项目的前景颜色 [英] Listbox: change Foregroundcolor for certain items

查看:98
本文介绍了列表框:更改某些项目的前景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有两个列表框,我可以在其中将项目从一个框移到另一个框,反之亦然.现在,我可以移动比列表中其他项目更通用的项目.当用户选择一个更通用的选项时,子项应被禁用.我将通过仅将标志设置为"disabled"来做到这一点.在我要禁用的对象中,并在SelectionChangedEvent上进行检查.

很长时间,没有问题.为了提高可用性,我想在列表框中将这些项目标记为已禁用.我正在考虑将这些项目的foregroungcolor(文本颜色)设置为灰色.这是问题所在...我该怎么办?我是否需要对Listbox进行子类化并覆盖渲染器或...

在此先感谢
-Marc

Hello Everyone

I have two Listboxes where I can move items from one box to the other and vice versa. Now I can move items which are more general than other items in the list. When the user selects one that is more general, the sub-items shall be disabled. I will do this by just setting a flag "disabled" in the Objects I want to disable and check for this one on the SelectionChangedEvent.

So long, no problem. For usability I would like to mark these items as disabled grafically in the Listbox. I was thinking of setting the foregroungcolor (textcolor) for those items to grey. And here is the problem...how can I do this? Do I need to subclass the Listbox and overwrite a renderer or ...

Thanks in advance
-- Marc

推荐答案


这么久,没问题.为了提高可用性,我想在列表框中将这些项目标记为已禁用.我正在考虑将这些项目的foregroungcolor(文本颜色)设置为灰色.这是问题所在...我该怎么办?我需要子类化吗 列表框并覆盖渲染器或...

预先感谢
-马克
Macro81 said:

Hello Everyone

I have two Listboxes where I can move items from one box to the other and vice versa. Now I can move items which are more general than other items in the list. When the user selects one that is more general, the sub-items shall be disabled. I will do this by just setting a flag "disabled" in the Objects I want to disable and check for this one on the SelectionChangedEvent.

So long, no problem. For usability I would like to mark these items as disabled grafically in the Listbox. I was thinking of setting the foregroungcolor (textcolor) for those items to grey. And here is the problem...how can I do this? Do I need to subclass the Listbox and overwrite a renderer or ...

Thanks in advance
-- Marc


这篇关于列表框:更改某些项目的前景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆