While using Application Styling, you may ask the following question: "What if I have an existing project that I want to use Application Styling in, but I don’t want to turn on Application Styling on the entire project?". There is a solution to this scenario, and it is the WebPageStyler component. This component is quite simple in its functionality and properties. The component has the following four properties:
EnableAppStyling — Enables/disables Application Styling for only the ASPX page that it is on. The default value is NotSet.
EnableViewState — Enables ViewState for the component, for use in page postback. The default value is True.
StyleSetName — The name of the StyleSet used for the ASPX page.
StyleSetPath — The path to the StyleSet. The default value is Null.
To enable Application Styling using the WebPageStyler component:
From the Toolbox, drag the WebPageStyler component to your form. The location of the component doesn’t matter, as the component has no run-time appearance.
In the Properties window for the WebPageStyler component, set the EnableAppStyling property to True.
Select the StyleSetName property. You will see a drop-down list appear, showing your imported StyleSets. If you have not imported any StyleSets, select Import from the drop-down list, and a dialog box opens, allowing you to import your StyleSets. Once they are imported, specify the StyleSet by selecting it from the drop-down list.
Your page is now set up to use Application Styling. Run the page to see your StyleSet take effect.