WiX UI Not Updating As Expected

During my recent forays into the world of WiX I’ve been slowly hacking away at the steep learning curve. This really is a huge framework that is dealing with an intrisically complicated process. For my own projects I’ve always stuck with Inno Setup and to be honest I don’t have any compelling reason to move them away from Inno at the moment as they are functioning as expected.

Anyway, the last problem I’ve encountered that took a question to the WiX mailing list to answer was regarding showing messages conditionally in the UI based on custom property values changing.  What was confusing was that the log file showed all the custom actions and properties being correctly processed but the UI never actually updated.  Sound familiar?  If you’r having this problem, simply try hitting the back or next button and then go back to the dialog that should have updated?  I bet you now see the updated value in the UI (provided all your WiX source is correct of course!).

This issue is that dialogs are never redrawn.  This is actually a limitation in the MSI UI implementation.  Whilst I haven’t looked into alternatives like replacing the MSI UI (lots of work apparently) there is a hacky solution to this.  Making twin dialogs … basically you create an exact copy of the dialog that should be updated and then once the property changes you simply show this twin dialog and it will appear as though the UI has updated when in fact it’s showing an entirely new dialog.

In the snippet below you can see that the last published event is the call to the current dialogs twin. You will need to give the twin dialog a new Id but all the others can remain the same. Not a nice solution as you now have two dialogs to maintain with any changes but it is a solution none-the-less.

<Control Id="TestDbConnection" Type="PushButton" Width="100" Height="17" X="19" Y="202" Text="Test Connection" TabSkip="no">
    <Publish Event="DoAction" Value="SetGeneratedConnectionString">1</Publish>
    <Publish Event="DoAction" Value="CheckDataAccessCa">1</Publish>
    <Publish Event="NewDialog" Value="DatabaseConfigTwinDlg">1</Publish>

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.