Loading...
Loading...
Guide for implementing Syncfusion WinForms BannerTextProvider (watermark text provider) control. Use this when working with watermark text, placeholder text, or hint text in editor controls. Covers setup, text modes (FocusMode/EditMode), color/font customization, and supported control types in Windows Forms applications.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-banner-text-provider// 1. Create BannerTextProvider (usually in Form designer or Form_Load)
BannerTextProvider bannerTextProvider = new BannerTextProvider(this.components);
// 2. Create TextBoxExt control
TextBoxExt textBox = new TextBoxExt()
{
Size = new System.Drawing.Size(200, 30),
Location = new System.Drawing.Point(20, 20)
};
this.Controls.Add(textBox);
// 3. Set banner text
BannerTextInfo bannerInfo = new BannerTextInfo()
{
Text = "Enter your name...",
Visible = true,
Font = new System.Drawing.Font("Verdana", 9, System.Drawing.FontStyle.Italic),
Color = System.Drawing.Color.Gray,
Mode = BannerTextMode.EditMode // Disappears when user types
};
bannerTextProvider.SetBannerText(textBox, bannerInfo);bannerTextProvider.SetBannerText(textBox,
new BannerTextInfo("Type here...", true));var bannerInfo = new BannerTextInfo(
Text = "Email address",
Visible = true,
Font = new Font("Verdana", 8.25f, FontStyle.Italic),
Color = Color.RoyalBlue,
Mode = BannerTextMode.EditMode
);
bannerTextProvider.SetBannerText(emailTextBox, bannerInfo);var bannerInfo = new BannerTextInfo(
Text = "Click to edit",
Visible = true,
Color = Color.LightGray,
Mode = BannerTextMode.FocusMode // Disappears on focus
);
bannerTextProvider.SetBannerText(textBox, bannerInfo);var controls = new[] { nameTextBox, emailTextBox, phoneTextBox };
var placeholders = new[] { "Full Name", "Email Address", "Phone Number" };
for (int i = 0; i < controls.Length; i++)
{
bannerTextProvider.SetBannerText(controls[i],
new BannerTextInfo(placeholders[i], true));
}| Mode | Behavior | Best For |
|---|---|---|
| FocusMode | Banner text disappears when control receives focus | Quick hint text, temporary guidance |
| EditMode | Banner text disappears only when control contains text | Persistent watermarks, clear differentiation |
TextSyncfusion.Shared.Base