NigelStratton
Apprentice

Quickly update styles in designer

Have you ever had to change a bunch of styles on a view to the same thing? Here's a quick way.

Select a control in the designer, press F12 to open Dev Tools and paste this
 
$sn(SourceCode.Forms.Designers.View.controlPropertiesXML,`//Control[@ID='${SourceCode.Forms.Designers.View.selectedObject.attr("id")}']/Styles`)
 
It will return something like this. Find the property you want and work out it's parent nodes.

<Styles>
    <Style IsDefault="True">
        <BackgroundColor>#00427c</BackgroundColor>
        <Font>
            <Size>10pt</Size>
            <Color>#ffffff</Color>
            <Style>normal</Style>
            <Weight>bold</Weight>
        </Font>
    </Style>
</Styles>
 
For the Background Color the parent nodes are /Style/BackgroundColor

To change the Background Color

$sn(SourceCode.Forms.Designers.View.controlPropertiesXML,`//Control[@ID='${SourceCode.Forms.Designers.View.selectedObject.attr("id")}']/Styles/Style/BackgroundColor`).innerHTML="#00427c"
 
Hit Enter and the control is updated. You won't see the changes unless you open the style dialog but if you save, the updated styles are saved. Now, click another control in the designer, up arrow in Dev Tools and hit Enter to update it too.

I haven't worked out how to refresh the control after the change but at least you can save the changes. 🙂 Of course this is highly likely to destroy your view in a firey blaze of useless XML, so have a Cancel Checkout ready.
 
Maybe hit the Kudos if this helps.
Reply
1 Reply
kentw1
Apprentice

Re: Quickly update styles in designer

Hi NigelStratton,


 


Thank you for sharing this information with the community!


 


Kent

0 Kudos
Reply