Placeholder textbox wpf

Diego Alvarez 101 Reputation points
2020-07-02T18:26:40.217+00:00

Is there a property, tag or element that allows adding placeholders to textboxes in WPF?

Thank you.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,685 questions
0 comments No comments
{count} votes

3 additional answers

Sort by: Most helpful
  1. Sabrina Cosolo 126 Reputation points
    2020-07-03T10:52:44.743+00:00

    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

    0 comments No comments

  2. Diego Alvarez 101 Reputation points
    2020-07-03T20:31:44.133+00:00

    I need to put a predefined text in the textbox. This text disappears when the textbox is clicked

    0 comments No comments

  3. Diego Alvarez 101 Reputation points
    2020-07-05T16:44:57.077+00:00

    Thanks for the reply. This is what I need.

    0 comments No comments