Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One nice looking way is to make your default text a watermark. I assume this is going to be in a UserControl so here is my implementation</p> <pre><code>&lt;UserControl.Resources&gt; &lt;SolidColorBrush x:Key="brushWatermarkBackground" Color="White" /&gt; &lt;SolidColorBrush x:Key="brushWatermarkForeground" Color="LightSteelBlue" /&gt; &lt;SolidColorBrush x:Key="brushWatermarkBorder" Color="Indigo" /&gt; &lt;utilities:TextInputToVisibilityConverter x:Key="TextInputToVisibilityConverter" /&gt; &lt;utilities:VisibilityToColorConverter x:Key="VisibilityToColorConverter" /&gt; &lt;/UserControl.Resources&gt; &lt;Grid&gt; &lt;TextBlock Name="MsgHeader1" HorizontalAlignment="Center" Margin="18,0,19,134" Width="308" Text="Enter Name Here..." Foreground="{StaticResource brushWatermarkForeground}" Height="46" VerticalAlignment="Bottom" Background="White"&gt; &lt;TextBlock.Visibility&gt; &lt;MultiBinding Converter="{StaticResource TextInputToVisibilityConverter}"&gt; &lt;Binding ElementName="MsgHeader2" Path="Text.IsEmpty" /&gt; &lt;Binding ElementName="MsgHeader2" Path="IsFocused" /&gt; &lt;/MultiBinding&gt; &lt;/TextBlock.Visibility&gt; &lt;/TextBlock&gt; &lt;TextBox Name="MsgHeader2" TextWrapping="Wrap" Background="{Binding ElementName=MsgHeader1, Path=Visibility, Converter={StaticResource VisibilityToColorConverter}}" BorderBrush="{StaticResource brushWatermarkBorder}" Margin="18,0,19,134" Text="{Binding MessageHeader}" HorizontalAlignment="Center" Width="308" Height="46" VerticalAlignment="Bottom" /&gt; &lt;/Grid&gt; </code></pre> <p>Obviously you have to define your own ValueConverters (mine are my own utilities xmlns), but these are easy enough. This will also give you a data binding for your text once you have some that has been entered.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload