Is it possible to hide textboxes on checkbox checked in WiX?
Thanks for your comments, the first comment helped me. It is done like this:
<Control Id="LoginTextBox" Type="Edit" Text="CM2" Height="17" Width="200" X="150" Y="198" Property="Login">
<Condition Action="hide" >CreateDBUsers<>1</Condition>
<Condition Action="show" >CreateDBUsers=1</Condition>
</Control>
This is a very old question, and the answer is: Yes it is possible.
I finally get how this works based on this blog post and Bogdan Verbenets's answer. To elaborate already chosen answer, this snippet based on his answer might help you understand more:
<Control Id="AnyCheckBox" Type="CheckBox" Height="17" Width="10" X="150" Y="180" Property="CreateDBUsers" CheckBoxValue="1" />
<Control Id="LoginTextBox" Type="Edit" Text="CM2" Height="17" Width="200" X="150" Y="198" Property="Login">
<Condition Action="hide"><![CDATA[CreateDBUsers<>"1"]]></Condition>
<Condition Action="show">CreateDBUsers="1"</Condition>
</Control>
Which the above code work the same as below:
<Control Id="AnyCheckBox" Type="CheckBox" Height="17" Width="10" X="150" Y="180" Property="CreateDBUsers" CheckBoxValue="0" />
<Control Id="LoginTextBox" Type="Edit" Text="CM2" Height="17" Width="200" X="150" Y="198" Property="Login">
<Condition Action="hide"><![CDATA[CreateDBUsers<>"0"]]></Condition>
<Condition Action="show">CreateDBUsers="0"</Condition>
</Control>
Please pay attention to CheckBoxValue
which its value determine what you going to write in the condition text.
Note:
<![CDATA[ write_something_here ]]>
when you need to write conditional involving <
(less than equal) or >
(greater than equal)."1"
, "0"
) in condition text since CheckBoxValue
actually use string data type, you can check at official documentation. Although this is not mandatory.Check box is definitely quite a something different in WiX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With