How can I set the default value of a UI control in WiX installer? When I change the value in the control, the changes are propagated to the property. But I want some sp开发者_JAVA技巧ecific value to be set when the dialog is first displayed.
<?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>
you may add Indirect="yes"
to yout control definition, after that control will display your property's value and all changes to control will change your property immideately.
for example,
<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>
This seemed to work for me (Indirect="yes"
didn't work). When that dialog was shown, the control had Show this value in the box as its value.
<?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>
精彩评论