O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required