如何在WiX中设置UI控件的默认值?
如何在WiX安装程序中设置UI控件的默认值? 当我更改控件中的值时,更改将传播到属性。但是我想在第一次显示对话框时设置一些特定的值如何在WiX中设置UI控件的默认值?,wix,Wix,如何在WiX安装程序中设置UI控件的默认值? 当我更改控件中的值时,更改将传播到属性。但是我想在第一次显示对话框时设置一些特定的值 <?xml version="1.0" encoding="utf-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <Property Id="PORT" Value="8731" /> <UI>
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Property Id="PORT" Value="8731" />
<UI>
<Dialog Id="MyDialog" Width="370" Height="270" Title="Service protocol configuration">
<!-- ... -->
<Control Type="Edit" Id="PortEdit" Width="52" Height="15" X="79" Y="68" Text="8731" Property="PORT" Integer="yes" />
</Dialog>
</UI>
</Fragment>
</Wix>
您可以将
Indirect=“yes”
添加到控件定义中,之后该控件将显示您的属性值,对控件的所有更改都将立即更改您的属性
比如说,
<Dialog Id="InstallDirDlgMine" Width="370" Height="270" Title="!(loc.InstallDirDlgMine_Header)">
...
<Control Id="Folder" Type="PathEdit" X="135" Y="72" Width="230" Height="20" Property="WIXUI_INSTALLDIR" Indirect="yes" />
...
</Dialog>
...
...
这似乎对我有效(Indirect=“yes”
不起作用)。显示该对话框时,控件已在框中显示该值作为其值
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Property Id="MYPROPERTY" Value="Show this value in the box" />
<UI>
<Dialog Id="MyIdDlg" Width="370" Height="270" Title="My Title">
<!-- omitted -->
<Control Id="MyId" Type="Edit" X="20" Y="100" Width="320" Height="18" Property="MYPROPERTY" />
</Dialog>
</UI>
</Fragment>
</Wix>
您可以添加一个示例吗?添加间接属性会导致“错误2819:对话框上的控件需要链接到它的属性”尝试删除“文本”参数。。。文本应该取自属性,可能是它导致了该错误。