Loading...
Loading...
Guide for implementing the Syncfusion WinUI Shadow (SfShadow) control to add depth and elevation effects to UI elements. Use this skill when implementing shadow effects, applying shadows to buttons/images/shapes, creating visual depth and elevation, or adding drop shadows for UI layering in WinUI 3. Covers installation, basic usage, and customization options including shadow color, blur, offset, and corner radius for material design depth effects.
npx skill4agent add syncfusion/winui-ui-components-skills syncfusion-winui-shadowSfShadowSfShadowSyncfusion.UI.Xaml.CoreSyncfusion.Core.WinUI<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="using:Syncfusion.UI.Xaml.Core">
<Grid>
<syncfusion:SfShadow>
<Button Height="50" Width="100" Content="Click Me"/>
</syncfusion:SfShadow>
</Grid>
</Page>using Syncfusion.UI.Xaml.Core;
// Create shadow control
SfShadow shadow = new SfShadow();
// Create button
Button button = new Button();
button.Height = 50;
button.Width = 100;
button.Content = "Click Me";
// Add button to shadow
shadow.Content = button;<syncfusion:SfShadow
Color="DarkBlue"
BlurRadius="10"
OffsetX="5"
OffsetY="5">
<Button Height="50" Width="120" Content="Action"/>
</syncfusion:SfShadow><syncfusion:SfShadow
BlurRadius="15"
OffsetX="0"
OffsetY="8"
ShadowCornerRadius="8">
<Border
Background="White"
CornerRadius="8"
Padding="20">
<TextBlock Text="Card Content"/>
</Border>
</syncfusion:SfShadow><syncfusion:SfShadow
BlurRadius="12"
OffsetX="4"
OffsetY="4">
<Image
Height="150"
Width="150"
Source="/Assets/photo.png"/>
</syncfusion:SfShadow><syncfusion:SfShadow
ShadowCornerRadius="25"
BlurRadius="8"
OffsetX="3"
OffsetY="3">
<Button
Height="50"
Width="50"
CornerRadius="25"
Content="+"
FontSize="24"/>
</syncfusion:SfShadow><StackPanel Orientation="Horizontal">
<syncfusion:SfShadow>
<Path Data="M44.5 4L54.0608 33.4114H85L59.9696 51.5886L69.5304 81L44.5 62.8228L19.4696 81L29.0304 51.5886L4 33.4114H34.9392L44.5 4Z"
Fill="#FFD700"/>
</syncfusion:SfShadow>
<!-- Repeat for more stars -->
</StackPanel><syncfusion:SfShadow EnableShadow="{Binding IsElevated}">
<Button Content="Toggle Shadow"/>
</syncfusion:SfShadow>// Toggle shadow programmatically
shadow.EnableShadow = false; // Disable shadow
shadow.EnableShadow = true; // Enable shadow| Property | Type | Default | Description |
|---|---|---|---|
| object | null | The UI element to apply shadow to |
| Color | Black (25% alpha) | Shadow color with transparency |
| double | 8 | Blur intensity (higher = softer shadow) |
| double | 0 | Corner radius of the shadow |
| double | 4 | Horizontal shadow offset (+ = right, - = left) |
| double | 4 | Vertical shadow offset (+ = down, - = up) |
| bool | true | Show or hide shadow effect |
<syncfusion:SfShadow OffsetX="0" OffsetY="2" BlurRadius="4">
<Button Content="Resting"/>
</syncfusion:SfShadow><syncfusion:SfShadow OffsetX="0" OffsetY="4" BlurRadius="8">
<Button Content="Raised"/>
</syncfusion:SfShadow><syncfusion:SfShadow OffsetX="0" OffsetY="8" BlurRadius="16">
<Button Content="Elevated"/>
</syncfusion:SfShadow><Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<syncfusion:SfShadow x:Name="ButtonShadow" OffsetY="2" BlurRadius="4">
<ContentPresenter/>
</syncfusion:SfShadow>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonShadow" Property="OffsetY" Value="8"/>
<Setter TargetName="ButtonShadow" Property="BlurRadius" Value="16"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style><ItemsControl ItemsSource="{Binding Photos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<syncfusion:SfShadow
BlurRadius="10"
OffsetX="4"
OffsetY="4"
Margin="10">
<Image Source="{Binding ImagePath}" Height="150" Width="150"/>
</syncfusion:SfShadow>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>ShadowCornerRadiusCornerRadiusEnableShadowtrue