使用WiX选择树控件,当我选择功能1时,我希望自动选择功能2
我在选择树控件中有三个功能。我希望独立选择和安装功能2和3,但如果选择安装功能1,我希望自动选择功能2,因为功能1依赖于它。当显示我的选择树时,我看到:使用WiX选择树控件,当我选择功能1时,我希望自动选择功能2,wix,windows-installer,conditional-statements,selected,treecontrol,Wix,Windows Installer,Conditional Statements,Selected,Treecontrol,我在选择树控件中有三个功能。我希望独立选择和安装功能2和3,但如果选择安装功能1,我希望自动选择功能2,因为功能1依赖于它。当显示我的选择树时,我看到: [-] All Features [x] Feature 1 (requires Feature 2) [x] Feature 2 [x] Feature 3 其中[-]表示“将安装在本地硬盘上”的图标 [x]表示“整个功能将不可用”的图标 当我选择要安装的功能1时,我看到: [-] All Featu
[-] All Features
[x] Feature 1 (requires Feature 2)
[x] Feature 2
[x] Feature 3
其中[-]表示“将安装在本地硬盘上”的图标
[x]表示“整个功能将不可用”的图标
当我选择要安装的功能1时,我看到:
[-] All Features
[-] Feature 1 (requires Feature 2)
[x] Feature 2
[x] Feature 3
但当我选择功能1时,我希望自动选择功能2,因此它将如下所示:
[-] All Features
[-] Feature 1 (requires Feature 2)
[-] Feature 2
[x] Feature 3
我不希望自动选择功能3,因为功能1不需要它。有办法做到这一点吗?这似乎是一个简单的问题,但我找不到任何关于如何做到这一点的文档或示例。我曾尝试在Feature2中使用一个条件,如下所示,但该条件从未得到测试,因为只选择了Feature1:
<Feature Id="ProductFeature" Title="All Features" Display="expand" Level="1">
<Feature Id="Feature1" ConfigurableDirectory="APPLICATIONFOLDER"
Title="Feature 1 (requires Feature 2)" Level="2">
<ComponentRef Id="file1.txt" />
</Feature>
<Feature Id="Feature2" ConfigurableDirectory="APPLICATIONFOLDER"
Title="Feature 2" Level="2">
<ComponentRef Id="file2.txt" />
<Condition Level="1">MsiSelectionTreeSelectedFeature="Feature1"</Condition>
</Feature>
<Feature Id="Feature3" ConfigurableDirectory="APPLICATIONFOLDER"
Title="Feature 3" Level="2">
<ComponentRef Id="file3.txt" />
</Feature>
</Feature>
MsiSelectionTreeSelectedFeature=“功能1”
如果只选择了功能1,是否有办法“告诉它”将功能2的级别属性设置为1,以便选择树中的功能2显示图标,显示它也将被安装?如果尝试设置Feature2的Level属性不是正确的方法,那么有没有其他方法可以用来实现我想要的行为
如果您想尝试,以下是我的完整程序:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="41788c15-290e-426f-934e-e5b3bf875013" Name="WixUI_FeatureTree"
Language="1033" Version="1.0.0.0" Manufacturer="WixUI_FeatureTree"
UpgradeCode="5f5d4f80-96f5-4060-a718-539b547d8a29">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<?define FeatureTree=1?>
<UIRef Id="MyWixUI_FeatureTree" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONFOLDER" Name="WixUI_FeatureTree">
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONFOLDER">
<Component Id="file1.txt" Guid="FEBD6C0C-1BDF-413C-B7B1-A4E18AC7A6FA">
<File Id="file1.txt" Source="file1.txt" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="file2.txt" Guid="FEBD6C0C-1BDF-413C-B7B1-A4E18AC7A6FB">
<File Id="file2.txt" Source="file2.txt" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="file3.txt" Guid="FEBD6C0C-1BDF-413C-B7B1-A4E18AC7A6FC">
<File Id="file3.txt" Source="file3.txt" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="All Features" Display="expand" Level="1">
<Feature Id="Feature1" ConfigurableDirectory="APPLICATIONFOLDER"
Title="Feature 1 (requires Feature 2)" Level="2">
<ComponentRef Id="file1.txt" />
</Feature>
<Feature Id="Feature2" ConfigurableDirectory="APPLICATIONFOLDER"
Title="Feature 2" Level="2">
<ComponentRef Id="file2.txt" />
<Condition Level="1">MsiSelectionTreeSelectedFeature="Feature1"</Condition>
</Feature>
<Feature Id="Feature3" ConfigurableDirectory="APPLICATIONFOLDER"
Title="Feature 3" Level="2">
<ComponentRef Id="file3.txt" />
</Feature>
</Feature>
</Product>
</Wix>
MsiSelectionTreeSelectedFeature=“功能1”
您可以尝试为级别设置一个变量吗,这样,您可以在单击“下一步”按钮时使用自定义操作,例如,检查功能1是否已选中,然后将功能2变量更新到所需级别?使用带有自定义操作的变量是一个好主意,但我希望在单击“下一步”按钮之前,功能2在UI中显示为选中。最后,我使用自己的复选框创建了自己的对话框,这使我能够做自己想做的事情,因为它使我能够完全控制在单击“下一步”按钮之前复选框的显示方式。