Skip to content

You can create a tiled background with the specified content.

cs
[TemplatePart(Name = ElementRoot, Type = typeof(Border))]
[ContentProperty(nameof(Content))]
public class Watermark : Control

Attributes

PropertyDescriptionDefault ValueRemarks
AngleWatermark rotation angle20provided by default style
ContentContent that needs to use watermark
MarkWatermark
MarkWidthWatermark width0
MarkHeightWatermark height0
MarkBrushWatermark color
AutoSizeEnabledWhether the watermark is automatically adapted to the sizetrue
MarkMarginWatermark Margin

Case

xml
 <hc:UniformSpacingPanel VerticalAlignment="Center" Margin="32" ChildWrapping="Wrap" Spacing="16" ItemWidth="256" ItemHeight="128">
<hc:Watermark Mark="HandyControl">
    <Border BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource BorderBrush}" />
</hc:Watermark>
<hc:Watermark Mark="HandyControl" FontSize="30">
    <Border BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource BorderBrush}" />
</hc:Watermark>
<hc:Watermark Mark="HandyControl" FontSize="30" Angle="45">
    <Border BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource BorderBrush}" />
</hc:Watermark>
<hc:Watermark Mark="HandyControl" FontSize="30" Angle="45" MarkBrush="{DynamicResource DangerBrush}">
    <Border BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource BorderBrush}" />
</hc:Watermark>
<hc:Watermark Mark="HandyControl" FontSize="30" Angle="45" MarkBrush="{DynamicResource DangerBrush}" MarkMargin="10">
    <Border BorderThickness="1" CornerRadius="4" BorderBrush="{DynamicResource BorderBrush}" />
</hc:Watermark>
</hc:UniformSpacingPanel>
xml
<hc:Watermark Mark="Project" FontSize="80" FontWeight="Bold" MarkMargin="30,0"/>

Watermark

xml
<hc:Watermark Mark="{StaticResource GitHubStrGeometry}" MarkMargin="30,0" MarkWidth="200" MarkHeight="100"/>

Watermark

Released under the MIT License.