【问题标题】:How to create watermark in textbox using silverlight?如何使用 Silverlight 在文本框中创建水印?
【发布时间】:2014-07-12 02:50:44
【问题描述】:

有人可以向我解释如何使用 Silverlight 在文本框中创建水印吗?

【问题讨论】:

标签: silverlight windows-phone-7


【解决方案1】:

【讨论】:

    【解决方案2】:
    <Grid x:Name="SearchPanel">
        <TextBox x:Name="txtQuery" Text="{Binding Query, Mode=TwoWay}" Margin="8" Padding="3, 3, 21, 3"
            GotFocus="txtQuery_GotFocus" LostFocus="txtQuery_LostFocus"/>
    
        <TextBlock x:Name="lblSearchStatus" VerticalAlignment="Center" Margin="13, 0"
            Text="Enter some text ..."
            IsHitTestVisible="False">
        </TextBlock>
    </Grid>
    

    然后在 txtQuery_GotFocus 中隐藏 lblSearchStatus 并在 txtQuery_GotFocus 中再次显示。也可以通过情节提要完成。重要的部分是将 TextBlock 覆盖的 IsHitTestVisible 设置为 false。

    【讨论】:

    • 感谢奥利弗的回复。
    【解决方案3】:

    我创建了一个水印文本框和水印密码框。

    在 NuGet 上可用:WindowsPhoneControls

    您可以在这里查看源代码:

    https://github.com/JoshClose/WindowsPhoneControls

    【讨论】:

      猜你喜欢
      • 2013-04-25
      • 2012-03-10
      • 1970-01-01
      • 1970-01-01
      • 2018-03-01
      • 2014-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多