WIX radio button group

后端 未结 1 810
谎友^
谎友^ 2021-02-10 04:28

I am stuck in doing with WIX radio group button,I want to know

  1. Whether i can able to disable text box based on selection of WIX radio group button like mention

相关标签:
1条回答
  • 2021-02-10 04:38

    Assuming you have your Radio Button as following:

    <RadioButtonGroup Property="SOME_PROPERTY">
        <RadioButton Value="0" Text="disable / hide labels" />
        <RadioButton Value="1" Text="enable / show labels" />
    </RadioButtonGroup>
    

    you can control visibility or availablility of other elements in the dialog by using Condition sub-element:

    <Control Id="SomeLabel" Type="Text" Text="text:">
        <Condition Action="disable"><![CDATA[SOME_PROPERTY <> "1"]]></Condition>
        <Condition Action="enable"><![CDATA[SOME_PROPERTY = "1"]]></Condition>
    </Control>
    
    <Control Id="SomeLabel2" Type="Text" Text="text2:">
        <Condition Action="hide">SOME_PROPERTY = "0"></Condition>
        <Condition Action="show">SOME_PROPERTY = "1"></Condition>
    </Control>
    

    Following the request in comments, posting an example of updating property with values of Edit elements (some required control attributes are ommited for clarity):

    <CustomAction Id="CA_SET_TO_A" Property="P" Value="[AA]" />
    <CustomAction Id="CA_SET_TO_B" Property="P" Value="[BB]" />
    
    <Dialog Id="MyDialog" Title="[ProductName] Setup">
        <Control Id="Next" Type="PushButton" Default="yes" Text="!(loc.WixUINext)">
            <Publish Event="DoAction" Value="CA_SET_TO_A">R="USE_A"</Publish>
            <Publish Event="DoAction" Value="CA_SET_TO_B">R="USE_B"</Publish>
        </Control>
    
        <Control Id="MyRadioButton" Type="RadioButtonGroup" Property="R">
            <RadioButtonGroup Property="R">
                <RadioButton Value="USE_A" Text="Save text field 1" />
                <RadioButton Value="USE_B" Text="Save text field 2" />
            </RadioButtonGroup>
        </Control>
    
        <Control Id="A" Type="Edit" Property="AA" Text="{64}">
            <Condition Action="disable">R="USE_B"</Condition>
            <Condition Action="enable">R="USE_A"</Condition>
        </Control>
        <Control Id="B" Type="Edit" Property="BB" Text="{64}">
            <Condition Action="disable">R="USE_A"</Condition>
            <Condition Action="enable">R="USE_B"</Condition>
        </Control>
    </Dialog>
    
    0 讨论(0)
提交回复
热议问题