WPF label styling WPF label styling wpf wpf

WPF label styling


The error is correct, you cannot set a corner radius on a Label.

What you can do is wrap the Label with a Border and apply your style to that to get the desired look.

EDIT:

The Style Resource:

<Style x:Key="MyBorderStyle" TargetType="Border">      <Setter Property="BorderBrush" Value="White" />      <Setter Property="BorderThickness" Value="2" />      <Setter Property="CornerRadius" Value="3" /></Style>

The border wrapped label:

<Border Style="{StaticResource MyBorderStyle}">    <Label Content="My Label" /></Border>