xaml实现无边框窗口

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="MainWindow" Height="359.091" Width="535.227" AllowsTransparency="True" WindowStyle="None">


<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel >

</StackPanel>
<GridSplitter Grid.Column="1" HorizontalAlignment="Center" Width="1" Background="Black" ShowsPreview="True" />
<Label Grid.Column="2" BorderBrush="Black" />

</Grid>
</Window>

为自绘的标题栏添加MouseLeftButtonDown事件,并在事件中写入this.DragMove();即可实现窗口自由拖放功能。

posted @ 2019-06-10 17:01  Roarsun  阅读(390)  评论(0编辑  收藏  举报