Updating a WiX UI ListBox using DTF

By using Deployment Tools Foundation (DTF) which is now part of WiX, a listbox (or other control) can be updated in a much cleaner way via a Custom Action (CA) than it would otherwise have been achieved. The following code snippet shows how direct access to a ListBox control can be gained to add a record to it.

    session.Log("Begin Configure EWS Filter Custom Action");

    Database db = session.Database;
    string sqlInsertTemp = db.Tables["ListBox"].SqlInsertString + " TEMPORARY";
    View view = db.OpenView(sqlInsertTemp);
    view.Execute(new Record(new object[] { "LISTBOXVALUES", 1, "1", "One" }));

    session.Log("End Configure EWS Filter Custom Action");
catch (Exception ex)
    session.Log("ERROR in custom action ConfigureEwsFilter {0}",
    return ActionResult.Failure;

, , , , ,

  1. No comments yet.
(will not be published)