首先新建一个UserControl
<TextBox Name="XuNiBox" Width="0"/>
<Border Background="White" Height="30" Margin="10" CornerRadius="6" BorderThickness="1" BorderBrush="#D9D9D9">
<TextBox VerticalContentAlignment="Center" Padding="10 0" BorderThickness="0"
Background="Transparent" Name="TextBoxTxt" Text="{Binding TextPath}"
LostFocus="Textbox_Leave" Foreground="#A7A6AA"
GotFocus="Textbox_Enter"></TextBox>
</Border>
为了让鼠标强制失去坐标,我们新建一个 <TextBox Name="XuNiBox" Width="0"/>
然后添加两个鼠标事件:LostFocus="Textbox_Leave" 、GotFocu