I think you are looking to put a watermark in the textbox. Here is an article which shows how
https://learn.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-add-a-watermark-to-a-textbox
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is there a property, tag or element that allows adding placeholders to textboxes in WPF?
Thank you.
I think you are looking to put a watermark in the textbox. Here is an article which shows how
https://learn.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-add-a-watermark-to-a-textbox
From what I can understand of your Question, you are asking if there is a Way to add a Placeholder to a Textbox in WPF,
the WPF controls have all a Tag property where you can set an object attached to the control, but if the Placeholder is something you need to find the control you can use the property x:Name to give it a name in XAML and then from the csharp class you can find your Textbox by name
<TextBox n:Name="MyTextbox" />
in xaml
MyTextbox.Text = "This is the text";
is how to assign a text to the textbox from code.
HTH
Sabrina
I need to put a predefined text in the textbox. This text disappears when the textbox is clicked
Thanks for the reply. This is what I need.