Hint/Placeholder-Text for regular TextBox

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 6 years ago by Hagay
Version: 17.2.0664
Avatar

Hi,

Is there a control (other than the AutoCompleteBox) that supports Placeholder-Text this out-of-the-box?

I just have some regular UI that contains few TextBox controls and I want to give the user hints like "Type name" or "Type description" (rather than using external lables).

It is quite an easy task to create a ControlTemplate for TextBox that will support this, but I wonder if there is already one in your library that I can reuse.

Thanks!

Comments (4)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Yes if you are using our built-in native control themes, our TextBox theme supports hint properties.  You can use it like this:

<TextBox shared:HintProperties.Hint="Hint text" />


Actipro Software Support

Posted 11 months ago by BenjaminLopVic - France
Avatar

Hello,

This looks great, but could we align the hint to the top instead? I have a textbox for multi-line input, and having the hint centered doesn't look clean when we start typing.

Thank you.

Posted 11 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Unfortunately the template for the control vertically centers the hint presenter and there isn't a property available to alter that.  In the current version, you would have to clone our default SharedResourceKeys.TextBoxBaseStyleKey Style into your Application.Resources and alter the ContentPresenter.VerticalAlignment.

We have updated our template for the next build to vertically Stretch-align the hint when the TextBox is multi-line.  That will get things working how you would like.


Actipro Software Support

Posted 11 months ago by BenjaminLopVic - France
Avatar

Hello,

That's great, thank you :)

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.