Alternatively, there is a nice feature you can use through a custom action that tells the session to display a variety of dialog types:
Record record = new Record();
record.FormatString = string.Format("Would you like to remove program-generated data?");
MessageResult value = session.Message(InstallMessage.User | (InstallMessage)MessageBoxButtons.YesNo, record);
if (value == MessageResult.Yes)
{
// Remove program-generated data
}
See here for where I came up with this solution: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/UI-on-uninstall-td7593560.html#a7593572
See here for the variety of dialogs you can provide: https://msdn.microsoft.com/en-us/library/windows/desktop/aa371672(v=vs.85).aspx
To use this custom action only on uninstall, schedule it like so:
<CustomAction Id="ShowDialog" BinaryKey='CustomActionsBinary' DllEntry='ShowDialogRemoveFiles'
Execute='immediate' Return='check' Impersonate='no'/>
<Binary Id='CustomActionsBinary' SourceFile='CustomActions.CA.dll'/>
<InstallExecuteSequence>
<Custom Action='ShowDialog' Before='InstallFinalize'>REMOVE</Custom>
</InstallExecuteSequence>