In order to achieve this, we can bind both the feature and the prerequisite to one dialog control.
Basically, we will install the feature based on a UI control selection (i.e. a checkbox control) and we will use the same control to decide the installation of our prerequisite.
Please note that in order to make this work, the prerequisite should be added as a "feature-based"/"post-install" prerequisite.
Please go to "Dialogs" page and add a checkbox control on one of your dialogs (e.g. "WelcomeDlg") (to do so, you can use the "Control Toolbox" button from the toolbar)
As you can see, this control has a property assigned to it. Additionally, this property has a default value.
(both of the above can be changed)
You can now go in "Organization" page. Here, please select your feature and under "Installation Behavior", set the feature default behavior to:
Not installed --> Installed if:
CHECKBOX_1_PROP = "CheckBox"
This way, the feature will only be installed if the checkbox was checked.
Now please select the feature of your prerequisite and repeat the above steps for the prerequisite as well.
Now, the prerequisite should only be installed if the user has the checkbox checked.
The logic is as it follows:
- the checkbox is checked --> the feature is installed --> the prerequisite is installed
Hope this helps.