Last active
February 23, 2017 17:10
-
-
Save ionoy/89cc6005be77ca3f99bfafe093f8c2d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextBox { | |
#Watermark(bindingPath: "Xaml", watermarkText: "Insert XAML here") | |
} | |
mixin Watermark(bindingPath, watermarkText) for TextBox { | |
Style: combine Style { | |
TargetType: TextBox | |
Triggers: [ | |
DataTrigger { | |
Binding: bind $bindingPath convert (string str) => string.IsNullOrEmpty(str) | |
Value: true | |
#Setter("Text", $watermarkText) | |
#Setter("Opacity", 0.3) | |
} | |
DataTrigger { | |
Binding: bind IsFocused from $this | |
Value: true | |
#Setter("Opacity", 1) | |
#Setter("Text", bind Xaml) | |
} | |
DataTrigger { | |
Binding: bind $bindingPath convert (string str) => !string.IsNullOrEmpty(str) | |
Value: true | |
#Setter("Text", bind Xaml) | |
} | |
] | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment