C# wpf 自定义标题栏及无边框窗口
<Window x:Class=""
xmlns="/winfx/2006/xaml/presentation"
xmlns:x="/winfx/2006/xaml"
xmlns:d="/expression/blend/2008"
xmlns:mc="/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="370" Width="650"
AllowsTransparency="True"
Background="Transparent"
ResizeMode="NoResize"
WindowStyle="None"
>
<StackPanel Margin="10" Background="White">
<>
<DropShadowEffect ShadowDepth="0" BlurRadius="10" Opacity="0.8"/>
</>
<!--标题栏-->
<Grid Background="Gray" Height="50" >
<StackPanel Margin="0,0,10,0" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Width="40" Height=" 40" VerticalAlignment="Center" Cursor="Hand">
<>
<ControlTemplate>
<Grid Background="Transparent">
<Rectangle Width="30" Height="3" Fill="White" ></Rectangle>
</Grid>
</ControlTemplate>
</>
</Button>
<Button Width="40" Height=" 40" VerticalAlignment="Center" Cursor="Hand">
<>
<ControlTemplate>
<Grid Background="Transparent">
<Rectangle Width="30" Height="30" Stroke="White" StrokeThickness="3"></Rectangle>
</Grid>
</ControlTemplate>
</>
</Button>
<Button Width="40" Height=" 40" VerticalAlignment="Center" Cursor="Hand">
<>
<ControlTemplate>
<Grid Background="Transparent">
<Line Width="30" Height="30" X1="0" Y1="0" X2="30" Y2="30" StrokeThickness="3" Stroke="White" ></Line>
<Line Width="30" Height="30" X1="30" Y1="0" X2="0" Y2="30" StrokeThickness="3" Stroke="White" ></Line>
</Grid>
</ControlTemplate>
</>
</Button>
</StackPanel>
</Grid>
<!--客户区-->
</StackPanel>
</Window>