Loading...
Loading...
Compare original and translation side by side
SfShadowSfShadowSfShadowSyncfusion.UI.Xaml.CoreSyncfusion.Core.WinUISfShadowSyncfusion.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;<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;
// 创建阴影控件
SfShadow shadow = new SfShadow();
// 创建按钮
Button button = new Button();
button.Height = 50;
button.Width = 100;
button.Content = "Click Me";
// 将按钮添加到阴影控件中
shadow.Content = button;<syncfusion:SfShadow
Color="DarkBlue"
BlurRadius="10"
OffsetX="5"
OffsetY="5">
<Button Height="50" Width="120" Content="Action"/>
</syncfusion:SfShadow><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="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
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><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><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>
<!-- 更多星星可重复上述代码 -->
</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<syncfusion:SfShadow EnableShadow="{Binding IsElevated}">
<Button Content="Toggle Shadow"/>
</syncfusion:SfShadow>// 编程方式切换阴影显示状态
shadow.EnableShadow = false; // 禁用阴影
shadow.EnableShadow = true; // 启用阴影| 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 |
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| object | null | 需要添加阴影的UI元素 |
| Color | 黑色(25%透明度) | 带透明度的阴影颜色 |
| double | 8 | 模糊强度(数值越高阴影越柔和) |
| double | 0 | 阴影的圆角半径 |
| double | 4 | 阴影水平偏移量(正值向右,负值向左) |
| double | 4 | 阴影垂直偏移量(正值向下,负值向上) |
| bool | true | 显示或隐藏阴影效果 |
<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><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><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><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>ShadowCornerRadiusCornerRadiusShadowCornerRadiusCornerRadiusEnableShadowtrueEnableShadowtrue