Default text in combobox

℡╲_俬逩灬. 提交于 2019-12-19 04:44:12

问题


I have 2 comboboxes like on the image and would like to know if it is possible to set some kind of text field for the combobox (so the first box would state Members). This way I would like to get rid of the textboxes above the comboboxes.

I know this can be done by adding the "Members" to the dataset but I donøt want to do that. Is there another way?

BR


回答1:


The effect you are looking for is called a 'watermark', this can be achieved with a value converter as described in the following questions:

Watermark / hint text / placeholder TextBox in WPF

How to display default text "--Select Team --" in combo box on pageload in WPF?

Or via a behaviour, as described in the blogpost:

http://pwlodek.blogspot.com/2009/11/watermark-effect-for-wpfs-textbox.html



来源:https://stackoverflow.com/questions/8653383/default-text-in-combobox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!