Watermark in Windows Forms ComboBox (SfComboBox)
27 Apr 20211 minute to read
Null value
Watermark text can be shown in the SfComboBox control by setting the AllowNull property to true
. If the value is null and the editor portion of the control is empty, the watermark will be displayed as text in the SfComboBox control. The default value of AllowNull
is false
.
sfComboBox1.AllowNull = true;
sfComboBox1.AllowNull = True
Appearance
Watermark text can be changed by setting value to the Watermark property. Watermark fore color can be changed by setting value to the WatermarkForeColor
property. The default watermark text is None
.
sfComboBox1.Watermark = "Choose a US State";
sfComboBox1.Style.EditorStyle.WatermarkForeColor = Color.Blue;
sfComboBox1.Watermark = "Choose a US State"
sfComboBox1.Style.EditorStyle.WatermarkForeColor = Color.Blue