posts from 2021

XAML Lightweight styling done right

By Fons Sonnemans, 11-jan-2021

You can customize the appearance of your apps in many ways by using the XAML framework. Styles let you set control properties and reuse those settings for a consistent appearance across multiple controls.

With Lightweight styling you override the system brushes, and the color override will affect all controls that reference that brush. Although this is called styling you are not defining a style. You just create a ResourceDictionary with a ThemeDictionary in which you override the system brushes.

            <ResourceDictionary x:Key="Light">
                 <SolidColorBrush x:Key="ButtonBackground"                                   
                 <SolidColorBrush x:Key="ButtonForeground" 
                 <SolidColorBrush x:Key="ButtonBorderBrush"

These overriden system brushes make a normal Button control transparent with a purple border and text (content).


All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.