[]
        
(Showing Draft Content)

Placeholder

The placeholder provides contextual clues of what value an end-users should enter in a control. The text-based controls in Input like, TextBox, NumericEdit, and ComboBox, allow you to display placeholder text when nothing is selected or displayed in them. This text disappears as soon as a value is entered in the control.

The following image shows "Enter Phone Number" as a placeholder text in the TextBox control which hints the user to enter a phone number.

placeholder in textbox

The following code shows an example of configuring a placeholder in an Input text-based control TextBox using Placeholder property of the C1TextBox.

c1TextBox1.Placeholder = "Enter Phone Number";

Similarly, you can set the placeholder text in other text-based Input controls using their Placeholder property.

FloatingPlaceholderEnabled is a common property in text-based controls that, when set to true, makes the placeholder text behave as a control label for the control. This property allows the placeholder text in the control's text area to move and make space for the user to add content at runtime. However, the size of the control must be large enough to fit both the placeholder text and the user content. So, you need to set the size of the control using the MinimumSize property based on your requirements and also set the AutoSize property to false.

The following image shows floating placeholder for C1TextBox.

floating placeholder enabled property for textbox

The code below shows an example of adding floating placeholder for the TextBox Control.

c1TextBox1.MinimumSize = new System.Drawing.Size(150, 50);
c1TextBox1.AutoSize = false;
c1TextBox1.Multiline = true;
c1TextBox1.Placeholder = "Enter Phone Number";
c1TextBox1.FloatingPlaceHolderEnabled = true;