Applying styles programmatically
According to the information presented in the two previous recipes, you can use styles to easily adjust the design of your application. However, do you know that you can also apply styles programmatically? Thus, you can dynamically control the appearance of user interface. In this recipe, you will learn how to get data of the style defined in the page resources and apply it to an element with a suitable type.
As an example, you will prepare a page that presents four images. By default, they have a black border with a width of 3 pixels and its opacity set to 30%. After clicking on each image, its opacity should be changed to 100% and the border color should be set to blue. You will solve this problem by defining two styles, namely for active and inactive elements and applying a proper style after tapping on the photo.
Getting ready
To step through this recipe, you will only need the automatically generated project.
How to do it...
To prepare an example of applying...