Using WiX how do I disable/enable controls based on property change?
Asked Answered
O

1

7

I'm having a bit of a brain melt at the moment where I have a WiX Combobox and when I change the selection I want to disable/enable other UI controls.

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

That is when these events are triggered ...

  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'.

The following UI controls are flagged as disabled when WindowsAuth is selected and enabled when SqlAuth is selected...

  <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" />
Onfre answered 3/2, 2010 at 3:4 Comment(0)
M
13

This should do it:

<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>
Multicellular answered 5/2, 2010 at 0:15 Comment(1)
Perfect. I don't know why I couldn't see that.Onfre

© 2022 - 2024 — McMap. All rights reserved.