zoukankan      html  css  js  c++  java
  • WPF TextBox提示文字设定

    WPF TextBox框提示文字,鼠标划入提示文字消失

    <TextBox
    Width="248"
    VerticalContentAlignment="Center"
    BorderThickness="0"
    CaretBrush="White">
    <TextBox.Resources>
    <VisualBrush
    x:Key="HintText"
    AlignmentX="Left"
    Opacity="0.5"
    Stretch="None"
    TileMode="None">
    <VisualBrush.Visual>
    <TextBlock
    FontSize="12"
    Foreground="White"
    Text="{DynamicResource MsgUser}" />
    </VisualBrush.Visual>
    </VisualBrush>
    </TextBox.Resources>
    <TextBox.Style>
    <Style TargetType="TextBox">
    <Setter Property="Background" Value="Transparent" />
    <Style.Triggers>
    <Trigger Property="Text" Value="{x:Null}">
    <Setter Property="Background" Value="{StaticResource HintText}" />
    </Trigger>
    <Trigger Property="Text" Value="">
    <Setter Property="Background" Value="{StaticResource HintText}" />
    </Trigger>
    <Trigger Property="IsFocused" Value="true">
    <Setter Property="Background" Value="Transparent" />
    </Trigger>
    <!--<EventTrigger RoutedEvent="TextBox.PreviewTextInput" />-->
    </Style.Triggers>
    </Style>
    </TextBox.Style>
    </TextBox>
  • 相关阅读:
    ECNU-2574 Principles of Compiler
    C++调用C#生成的DLL文件的各种问题
    EOJ-1708//POJ3334
    Linux---弹球游戏
    dotfiles管理
    js基础的知识整理
    关于css的一些知识点整理
    HTML5 aria- and role
    JS获取非行间样式
    Javascript中的数组去重-indexof方法
  • 原文地址:https://www.cnblogs.com/amwuau/p/7562284.html
Copyright © 2011-2022 走看看