Max951
Max951

Reputation: 51

WPF Style for propery Tag of TextBox

How can I set the style for Tag property? For example Foreground in TextBox I want to set as White and Foreground for Tag as Grey.

<TextBox x:Name="MessageText"
         Style="{StaticResource MessageTextBox}"                     
         Tag="Type your message here"
</TextBox>

Is it possible?

Upvotes: 0

Views: 44

Answers (1)

E.Benedos
E.Benedos

Reputation: 1779

Probably you are a little bit confused about Tag property usage.

From microsoft docs:

This property is analogous to Tag properties in other Microsoft programming models, such as Visual Basic for Applications or Windows Forms. Tag is intended to provide a pre-existing property location where you can store some basic custom information about any FrameworkElement without requiring you to subclass an element.

It is only a property in which you can store some useful data to associate to you graphic element/control. It has no graphic/style purpose!

Probably you are looking for something like Watermark

Upvotes: 1

Related Questions