vue-java-tutorials/CSharp/WPFTutorial/WPF-5-CustomTextboxContro/View/UserControllers/ClearableTextBox.xaml

21 lines
1.1 KiB
XML

<UserControl x:Class="WPF_5_CustomTextboxContro.View.UserControllers.ClearableTextBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Height="40" Width="250">
<Grid Background="Wheat">
<TextBox Name="MyTextBox" Height="40" VerticalContentAlignment="Center" FontSize="16" FontWeight="Light"
Panel.ZIndex="-1" TextChanged="MyTextBox_OnTextChanged" />
<TextBlock Name="TbPlaceholder" FontSize="16" FontWeight="Light" Text="{Binding Placeholder}"
Foreground="DarkGray"
VerticalAlignment="Center" Margin="5 0 0 0 " Background="Transparent" />
<Button Name="ClearButton" Width="30" HorizontalAlignment="Right" Content="X" Background="Transparent"
Foreground="LightGray" BorderThickness="0" Click="ClearButton_OnClick" />
</Grid>
</UserControl>