Changing UI Properties on Runtime

If you want to assign custom properties using the code, you can use component.dispatch as follows:

function changeMargin(): void {
this.marginTop = 5; // Wrong. The property will be set but the UI will not be updated.
this.dispatch({
type: "updateUserStyle",
userStyle: {
marginTop: 5
}
});
// Perform this when position related properties to be changed
this.layout.applyLayout();
}

To learn more about dispatch and general usage, refer here:

For more technical information about dispatch and applylayout, refer the contx and styler repositories made by Smartface.