feat: add watermark support.

This commit is contained in:
rabbitism
2024-06-23 16:46:09 +08:00
parent 44d0700119
commit 4aa20d930f
3 changed files with 64 additions and 3 deletions

View File

@@ -25,6 +25,11 @@
BorderThickness="1"
CornerRadius="3">
<Panel HorizontalAlignment="Stretch">
<TextBlock
Name="{x:Static u:TagInput.PART_Watermark}"
Opacity="0.5"
IsVisible="False"
Text="{TemplateBinding Watermark}" />
<ItemsControl
Name="PART_ItemsControl"
HorizontalAlignment="Stretch"
@@ -42,6 +47,9 @@
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:empty /template/ TextBlock#PART_Watermark">
<Setter Property="IsVisible" Value="True"></Setter>
</Style>
<Style Selector="^:pointerover /template/ Border#PART_BackgroundBorder">
<Setter Property="Border.Background" Value="{DynamicResource TextBoxPointeroverBackground}" />
</Style>
@@ -123,10 +131,10 @@
Foreground="{TemplateBinding Foreground}" />
<ContentPresenter
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
FontSize="12"
Foreground="{TemplateBinding Foreground}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
FontSize="12"
Foreground="{TemplateBinding Foreground}"
TextTrimming="CharacterEllipsis" />
</DockPanel>
</Border>