后台都不用写任何代码!
xaml:
<Window x:Class="TestNoBorderWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="TestNoBorderWindow"
Width="300"
Height="300"
MinWidth="100"
MinHeight="100"
mc:Ignorable="d">
<Window.Style>
<Style TargetType="Window">
<Setter Property="Background" Value="Transparent" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="ResizeMode" Value="CanResize" />
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome CaptionHeight="30" ResizeBorderThickness="20" />
</Setter.Value>
</Setter>
</Style>
</Window.Style>
<Border Margin="10"
Background="White"
BorderBrush="Red"
BorderThickness="1"
CornerRadius="5"
SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect BlurRadius="10"
Direction="0"
ShadowDepth="0" />
</Border.Effect>
<Grid />
</Border>
</Window>