使用WiX如何根据属性更改禁用/启用控件?

时间:2010-02-03 03:04:45

标签: user-interface properties wix wix3

在我拥有WiX Combobox的那一刻,我有一点大脑融化,当我改变选择时,我想禁用/启用其他UI控件。

  <ComboBox Property="SQLAUTHTYPE">
    <ListItem Value="WindowsAuth" Text="Windows Authentication" />
    <ListItem Value="SqlAuth" Text="SQL Authentication" />
  </ComboBox>

这就是触发这些事件的时候......

  MSI (c) ... PROPERTY CHANGE: Modifying SQLAUTHTYPE property. Its current value is 'WindowsAuth'. Its new value: 'SqlAuth'.
  MSI (c) ... PROPERTY CHANGE: Modifying SQLAUTHTYPE property. Its current value is 'SqlAuth'. Its new value: 'WindowsAuth'.

选择WindowsAuth时,以下UI控件被标记为已禁用,并且在选择SqlAuth时启用...

  <Control Type="Edit" Width="164" Height="16" X="25" Y="149" Id="SQLAccountTextbox" Property="SQLACCOUNT"
  <Control Type="Edit" Width="164" Height="16" X="190" Y="148" Id="SQLPasswordTextbox" Property="SQLPASSWORD" Password="yes" />

1 个答案:

答案 0 :(得分:13)

这应该这样做:

<Control Type="Edit" Width="164" Height="16" X="190" Y="148" Id="SQLPasswordTextbox" Property="SQLPASSWORD" Password="yes">
    <Condition Action="enable">SQLAUTHTYPE = "SqlAuth"</Condition>
    <Condition Action="disable">SQLAUTHTYPE = "WindowsAuth"</Condition>
</Control>