-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the bug
In CSS, box-shadow: inset 0 2px 0 0 red produces a clearly visible 2px red shadow at the top edge of an element. The offset value directly corresponds to the shadow's visible size in pixels.
In Avalonia, BoxShadow="inset 0 2 0 0 Red" produces a non visible result. You need significantly larger values (e.g. inset 0 10 0 0 Red) to achieve what CSS does with just 2. The offset value doesn't represent a pixel measurement the way other Avalonia properties like BorderThickness or StrokeThickness do.
css box-shadow: inset 0px 2px 0px 0px red;

xaml BoxShadow="inset 0 2 0 0 Red"

xaml BoxShadow="inset 0 10 0 0 Red"

To Reproduce
<Border
Width="40"
Height="40"
BorderBrush="Gray"
BorderThickness="1"
BoxShadow="inset 0 2 0 0 Red">
<TextBlock
HorizontalAlignment="Center"
Text="inset" />
</Border>Expected behavior
Inset shadow offset values should map to pixels consistently with CSS and with other pixel-based properties in Avalonia.
Avalonia version
11.3.11
OS
macOS
Additional context
There might also be a bug with how avalonia preview renders boxshadow inset offsets. If you increase the zoom on the preview you will see the offset get even larger than it actually is when the app runs.