TextBox.Watermark Property
Silverlight
This property is not implemented.
Namespace: System.Windows.Controls
Assembly: System.Windows (in System.Windows.dll)
| Exception | Condition |
|---|---|
| NotImplementedException |
In all cases. |
Do not use this property. If you try to use this property, a NotImplementedException will be thrown.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Created my own watermark. Hope this helps everyone :)
$0'Note the namespace and class names. Just create two textboxes on called txtLogin and the other txtPassword$0
$0'Make sure you make the default textbox foreground color lightgray.$0
$0$0
$0
$0Imports System.Windows$0
$0Imports System.Windows.Controls$0
$0Imports System.Windows.Media$0
$0$0
$0
$0Namespace LoginNS$0
$0Partial Public Class Login$0
$0 'Make sure you make the default textbox foreground color lightgray.$0
$0 Public Sub New()$0
$0 InitializeComponent()$0
$0 AddHandler txtLogin.GotFocus, AddressOf LoginIsFocused$0
$0 AddHandler txtLogin.LostFocus, AddressOf LoginNotFocused$0
$0 AddHandler txtPassword.GotFocus, AddressOf PasswordIsFocused$0
$0 AddHandler txtPassword.LostFocus, AddressOf PasswordNotFocused$0
$0 End Sub$0
$0 Private Sub LoginIsFocused(ByVal sender As System.Object, ByVal e As RoutedEventArgs)$0
$0 IsFocusedProps(txtLogin, "Enter a Login")$0
$0 End Sub$0
$0 Private Sub LoginNotFocused(ByVal sender As System.Object, ByVal e As RoutedEventArgs)$0
$0 NotFocusedProps(txtLogin, "Enter a Login")$0
$0 End Sub$0
$0 Private Sub PasswordIsFocused(ByVal sender As System.Object, ByVal e As RoutedEventArgs)$0
$0 IsFocusedProps(txtPassword, "Enter a Password")$0
$0 End Sub$0
$0 Private Sub PasswordNotFocused(ByVal sender As System.Object, ByVal e As RoutedEventArgs)$0
$0 NotFocusedProps(txtPassword, "Enter a Password")$0
$0 End Sub$0
$0 Private Sub IsFocusedProps(ByVal focusedtxtbox As TextBox, ByVal txtboxtext As String)$0
$0 If focusedtxtbox.Text <> txtboxtext Then$0
$0 Exit Sub$0
$0 End If$0
$0 focusedtxtbox.Text = ""$0
$0 focusedtxtbox.Foreground = New SolidColorBrush(Colors.Black)$0
$0 End Sub$0
$0 Private Sub NotFocusedProps(ByVal focusedtxtbox As TextBox, ByVal txtboxtext As String)$0
$0 If focusedtxtbox.Text <> "" And focusedtxtbox.Text <> txtboxtext Then$0
$0 Exit Sub$0
$0 End If$0
$0 focusedtxtbox.Text = txtboxtext$0
$0 focusedtxtbox.Foreground = New SolidColorBrush(Colors.LightGray)$0
$0 End Sub$0
$0End Class$0
$0End Namespace$0
- 2/11/2011
- Shrewd.Logic
- 2/11/2011
- Shrewd.Logic
trying it in code reveals all
Where we stand appears to be that the compiler is fine with it, but it causes a runtime exception. MS folks, please give us this property. If not in TextBox, then in RichTextBox.
Wolf5370 said:
"As I have said before, stop wasting time on full length videos no one has time to watch and go back to putting out useful test based info we can search for and make use of."
AMEN to this!!! Videos certainly have their audiences, but for developers, text-based info, with screenshots where appropriate, is infinitely more useful than videos.
Wolf5370 said:
"As I have said before, stop wasting time on full length videos no one has time to watch and go back to putting out useful test based info we can search for and make use of."
AMEN to this!!! Videos certainly have their audiences, but for developers, text-based info, with screenshots where appropriate, is infinitely more useful than videos.
- 1/17/2011
- Anke6831
To USE or NOT to use?
Can anyone tell me where we are with this property. Documentation above contradicts itself?
- 11/29/2010
- Philip Mckee
I decided to use it, but didn't use it. or did i?
the document says both to use it in SL4 and to not use it. so which one is it?
thanks.
thanks.
- 7/20/2010
- Alejandro Pauly
- 8/1/2010
- Thomas Lee
Watermark
Does anyone in M$ actually read these comments - it would appear not - absolutely pointless document - "only supported in Silverlight 4"..."Do not use in Silverlight 4" - bprevious comments from other confused readers and no reply/comment/correction by M$, As I have said before, stop wasting time on full length videos no one has time to watch and go back to putting out useful test based info we can search for and make use of.
- 7/24/2010
- Wolf5370