locked
What should I do to create a TextBox (and a PasswordBox) whose description stays inside of it as much as the control is empty? RRS feed

  • Question

  • Hi.

    I am trying to make a login interface but I want to provide controls whose description can be seen without a TextBlock. I want it to be inside of the control, the same experience provided by the standart windows live login interface on win8. How can do this in xaml using C++.

    Thank you.

     

     

    Thursday, November 3, 2011 7:32 PM

Answers

  • Is there a reason you want to do this without a TextBlock?

    A typical way to implement such a watermark would be to place a TextBlock over the TextBox and fade the watermark in or out based on the TextBox's focus state and contents.  A more complicated variant would be to include the TextBlock in the TextBox's style and control its visibility with a VisualStateManager.

    If you search for TextBox WaterMark and Silverlight you should find some examples which will get you going in the right direction.

    --Rob

    Friday, November 4, 2011 12:25 AM
    Moderator

All replies

  • Is there a reason you want to do this without a TextBlock?

    A typical way to implement such a watermark would be to place a TextBlock over the TextBox and fade the watermark in or out based on the TextBox's focus state and contents.  A more complicated variant would be to include the TextBlock in the TextBox's style and control its visibility with a VisualStateManager.

    If you search for TextBox WaterMark and Silverlight you should find some examples which will get you going in the right direction.

    --Rob

    Friday, November 4, 2011 12:25 AM
    Moderator
  • you can use a textblock over a text box , when the text block is tapped you changed it's visibility to collapsed and set the focus of text box to keyboard.

    Thursday, August 16, 2012 7:56 PM