Wix工具集中的无边界窗口

问题描述:

我正在使用wix创建一个Windows安装程序,我希望它是无边界的。这可能吗?如果是这样,我怎样才能在窗口上创建一个可拖动的区域?Wix工具集中的无边界窗口

是的。这是可能的。看看这个。

<Window x:Class="WpfApplication1.MainWindow" 
    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" 
    xmlns:local="clr-namespace:WpfApplication1" 
    mc:Ignorable="d" 
    Height="350" Width="525" WindowStyle="None" ResizeMode="NoResize" > 
<Grid > 
    <Rectangle Fill="Gray" MouseDown="Rectangle_MouseDown" /> 
    <Grid Margin="10" Background="LightGray"> 
    ---your window elements go here--- 
    </Grid> 
</Grid> 

里面的矩形元素鼠标按下事件处理程序进入你的代码拖动窗口。因此,如果您单击矩形区域(即内部网格周围的区域),则可以拖动窗口。

private void Rectangle_MouseDown(object sender, MouseButtonEventArgs e) 
    { 
     if (e.ChangedButton == MouseButton.Left) 
      this.DragMove(); 
    } 
+0

我决定切换到Wix#为了获得更多的控制权,但感谢你的答案,希望它有助于某人:) – Mihai

+0

这不是一个WPF应用程序。问题说WIX安装程序。 –