Adding watermarks to Texbox with style
<Stylex:key= "PlaceHolder"TargetType="{x:type TextBox}"BasedOn="{StaticResource {x:type TextBox}}"> <Setter Property= "Template"> <Setter.value> <ControlTemplateTargetType="{x:type TextBox}"> <Grid> <TextBoxText="{Binding path=text, Relativesource={relativesource templatedparent}, Mode=twoway, Updatesourcetrig Ger=propertychanged}"x:name= "TextSource"Background= "Transparent"Panel.zindex= "2" /> <TextBoxText="{TemplateBinding Tag}"Background="{TemplateBinding Background}"Panel.zindex= "1"> <Textbox.style> <StyleTargetType="{x:type TextBox}"> <Setter Property= "Foreground"Value= "Transparent"/> <style.triggers> <DataTriggerBinding="{Binding path=text, source={x:reference TextSource}}"Value=""> <Setter Property= "Foreground"Value= "Lightgray"/> </DataTrigger> </style.triggers> </Style> </Textbox.style> </TextBox> </Grid> </ControlTemplate> </Setter.value> </Setter> </Style>
"WPF advanced" Cue or Hint or Watermark or Placehoder in controls (add hints, watermarks, placeholders for controls)