SlideShare a Scribd company logo
1 of 13
Windows 8.1 Themes
JIM O’NEIL
BLUEMETAL ARCHITECTS
HTTP://CODOCENT.COM
http://bit.ly/Win81Themes
http://bit.ly/Win81Themes
Agenda
RequestedTheme
Resources
Theme Dictionaries
Styles
Theme Generation
RequestedTheme (redux)
Dynamicizing Static Resources
Requested Theme
Application.Current.RequestedTheme
◦ Values
◦ Light
◦ Dark (default)
◦ High-contrast (Alt+Left Shift+PrntScn) setting overrides
◦ Can be set only at startup
◦ App.xaml
◦ In constructor code for the application
http://bit.ly/AppRequestedTheme
Yes, even in 8.1. 8.1 can detect
change to high contrast though.
Resources
Static Dynamic Theme
All XAML platforms WPF Windows 8.1 (Phone and Modern
App)
Assigned during loading Evaluated at runtime Static + reaction to theme
changes
{StaticResource MyBrush} {DynamicResource MyBrush} {ThemeResource MyBrush}
No forward references Forward references supported No forward references
http://bit.ly/ThemeResources
Reusable XAML elements
◦ Brushes
◦ Styles
◦ Converters
ThemeResource Dictionaries
Shipped in SDK for convenience, but files not used at runtime
◦ C:Program Files (x86)Windows Kits8.1Includewinrtxamldesign
Default (aka Dark)
Light
HighContrast
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Name="BlockFill"
Color="Red">
…
http://bit.ly/ResourceDictionary
Theme Dictionary Organization
Define distinct XAML files to store resource values by theme
Styles
Controls in XAML-based technologies are “lookless”
Styles get applied implicitly or explicitly
Each built-in control has an implicit style (stored, but not loaded from, generic.xaml)
http://bit.ly/AddingControls
Explicit Style
Theme-dependent brushes
Over 350 named brushes with dark, light, and system color (high contrast) mappings
Used in control style and template definitions
Each ends in “ThemeBrush”
http://bit.ly/ThemeResources
Theming and Styles
Implicit styles and templates for controls can be found:
◦ In generic.xaml in the SDK folder
◦ At the Windows Dev Center: http://bit.ly/AddingControls
Dev Center documentation includes cut-and-pasteable
◦ Dark theme brush definitions
◦ Light theme brush definitions
◦ Shared resources
◦ Default style definition
http://bit.ly/AddingControls
Theme Generation
Challenge: Each control has a palette of theme color resources for various states (selected,
pointer over, disabled, etc.) How do you create a consistent set of brush defintions around a
base theme color?
HAMMER.Pants… Hyper-Awesome, Malicious, Markup Enabled Reality.
An open source project/utility that generates a modified generic.xaml replacing all the
colored brushes with ones generated from an input base color.
http://bit.ly/HAMMERPants
RequestedTheme redux
Challenge: How do you handle elements that should appear the same regardless of application
theme – for example, controls on flyouts which are usually light-themed?
Option 1: Create an explicit “always light” theme
Option 2: Leverage FrameworkElement.ThemeResource
http://bit.ly/RequestedTheme
Dynamicizing Static Resources
Resources are programmatically accessible in the Application.Current.Resources
dictionary
There are some nuances:
◦ Modifying the color property of a brush will apply that change automatically
◦ Assigning a new brush instance will not be acknowledged until another element loads that resource
(e.g., navigate to a new page)
◦ Refreshing cached page class instances (NavigationCacheMode.Enabled) requires additional work
Thank you.
Jim O’Neil
BlueMetal Architects
jim.oneil@outlook.com
http://codocent.com
@jimoneil
http://bit.ly/Win81Themes
http://bit.ly/Win81Themes

More Related Content

Similar to Windows 8.1 Themes

Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
sasidhar
 
CustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputsCustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputs
Suite Solutions
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
Philip Johnson
 
Btb017 David
Btb017 DavidBtb017 David
Btb017 David
Rohit Ray
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
Tony Frame
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
Mediacurrent
 

Similar to Windows 8.1 Themes (20)

Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
Web Tools for GemStone/S
Web Tools for GemStone/SWeb Tools for GemStone/S
Web Tools for GemStone/S
 
CustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputsCustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputs
 
VS Saturday 2019 - Xamarin.Forms 4.x
VS Saturday 2019 - Xamarin.Forms 4.xVS Saturday 2019 - Xamarin.Forms 4.x
VS Saturday 2019 - Xamarin.Forms 4.x
 
CrowdFusion: The Front-End Edition, Part I: Presentation Layer
CrowdFusion: The Front-End Edition, Part I: Presentation LayerCrowdFusion: The Front-End Edition, Part I: Presentation Layer
CrowdFusion: The Front-End Edition, Part I: Presentation Layer
 
skintutorial
skintutorialskintutorial
skintutorial
 
skintutorial
skintutorialskintutorial
skintutorial
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
 
Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)
 
Facets of applied smw
Facets of applied smwFacets of applied smw
Facets of applied smw
 
Build a chatroom!
Build a chatroom!Build a chatroom!
Build a chatroom!
 
Btb017 David
Btb017 DavidBtb017 David
Btb017 David
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
 
Getting Started in Custom Programming for Talent Sourcing
Getting Started in Custom Programming for Talent SourcingGetting Started in Custom Programming for Talent Sourcing
Getting Started in Custom Programming for Talent Sourcing
 
Html5 introduction
Html5 introductionHtml5 introduction
Html5 introduction
 
Code generation
Code generationCode generation
Code generation
 
Dive into HTML5
Dive into HTML5Dive into HTML5
Dive into HTML5
 
.NET Recommended Resources
.NET Recommended Resources.NET Recommended Resources
.NET Recommended Resources
 
Getting started with titanium
Getting started with titaniumGetting started with titanium
Getting started with titanium
 

More from Jim O'Neil

More from Jim O'Neil (12)

Azure and DevOps: ARM & ARM
Azure and DevOps: ARM & ARMAzure and DevOps: ARM & ARM
Azure and DevOps: ARM & ARM
 
Weka Health Vaccine Smart Fridge
Weka Health Vaccine Smart FridgeWeka Health Vaccine Smart Fridge
Weka Health Vaccine Smart Fridge
 
Go Serverless with Azure Functions
Go Serverless with Azure FunctionsGo Serverless with Azure Functions
Go Serverless with Azure Functions
 
Windows Azure Cloud Services
Windows Azure Cloud ServicesWindows Azure Cloud Services
Windows Azure Cloud Services
 
Windows Azure Overview
Windows Azure OverviewWindows Azure Overview
Windows Azure Overview
 
Windows 8 App and Game Development Landscape
Windows 8 App and Game Development LandscapeWindows 8 App and Game Development Landscape
Windows 8 App and Game Development Landscape
 
MongoDB and Windows Azure
MongoDB and Windows AzureMongoDB and Windows Azure
MongoDB and Windows Azure
 
Azure overview
Azure overviewAzure overview
Azure overview
 
Hadoop in the Cloud
Hadoop in the CloudHadoop in the Cloud
Hadoop in the Cloud
 
The PaaS Landscape
The PaaS LandscapeThe PaaS Landscape
The PaaS Landscape
 
Sampling from the Cloud Smorgasbord
Sampling from the Cloud SmorgasbordSampling from the Cloud Smorgasbord
Sampling from the Cloud Smorgasbord
 
Drupal and Microsoft
Drupal and MicrosoftDrupal and Microsoft
Drupal and Microsoft
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 

Windows 8.1 Themes

  • 1. Windows 8.1 Themes JIM O’NEIL BLUEMETAL ARCHITECTS HTTP://CODOCENT.COM http://bit.ly/Win81Themes http://bit.ly/Win81Themes
  • 3. Requested Theme Application.Current.RequestedTheme ◦ Values ◦ Light ◦ Dark (default) ◦ High-contrast (Alt+Left Shift+PrntScn) setting overrides ◦ Can be set only at startup ◦ App.xaml ◦ In constructor code for the application http://bit.ly/AppRequestedTheme Yes, even in 8.1. 8.1 can detect change to high contrast though.
  • 4. Resources Static Dynamic Theme All XAML platforms WPF Windows 8.1 (Phone and Modern App) Assigned during loading Evaluated at runtime Static + reaction to theme changes {StaticResource MyBrush} {DynamicResource MyBrush} {ThemeResource MyBrush} No forward references Forward references supported No forward references http://bit.ly/ThemeResources Reusable XAML elements ◦ Brushes ◦ Styles ◦ Converters
  • 5. ThemeResource Dictionaries Shipped in SDK for convenience, but files not used at runtime ◦ C:Program Files (x86)Windows Kits8.1Includewinrtxamldesign Default (aka Dark) Light HighContrast <?xml version="1.0" encoding="utf-8"?> <ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <ResourceDictionary.ThemeDictionaries> <ResourceDictionary x:Key="Default"> <SolidColorBrush x:Name="BlockFill" Color="Red"> … http://bit.ly/ResourceDictionary
  • 6. Theme Dictionary Organization Define distinct XAML files to store resource values by theme
  • 7. Styles Controls in XAML-based technologies are “lookless” Styles get applied implicitly or explicitly Each built-in control has an implicit style (stored, but not loaded from, generic.xaml) http://bit.ly/AddingControls Explicit Style
  • 8. Theme-dependent brushes Over 350 named brushes with dark, light, and system color (high contrast) mappings Used in control style and template definitions Each ends in “ThemeBrush” http://bit.ly/ThemeResources
  • 9. Theming and Styles Implicit styles and templates for controls can be found: ◦ In generic.xaml in the SDK folder ◦ At the Windows Dev Center: http://bit.ly/AddingControls Dev Center documentation includes cut-and-pasteable ◦ Dark theme brush definitions ◦ Light theme brush definitions ◦ Shared resources ◦ Default style definition http://bit.ly/AddingControls
  • 10. Theme Generation Challenge: Each control has a palette of theme color resources for various states (selected, pointer over, disabled, etc.) How do you create a consistent set of brush defintions around a base theme color? HAMMER.Pants… Hyper-Awesome, Malicious, Markup Enabled Reality. An open source project/utility that generates a modified generic.xaml replacing all the colored brushes with ones generated from an input base color. http://bit.ly/HAMMERPants
  • 11. RequestedTheme redux Challenge: How do you handle elements that should appear the same regardless of application theme – for example, controls on flyouts which are usually light-themed? Option 1: Create an explicit “always light” theme Option 2: Leverage FrameworkElement.ThemeResource http://bit.ly/RequestedTheme
  • 12. Dynamicizing Static Resources Resources are programmatically accessible in the Application.Current.Resources dictionary There are some nuances: ◦ Modifying the color property of a brush will apply that change automatically ◦ Assigning a new brush instance will not be acknowledged until another element loads that resource (e.g., navigate to a new page) ◦ Refreshing cached page class instances (NavigationCacheMode.Enabled) requires additional work
  • 13. Thank you. Jim O’Neil BlueMetal Architects jim.oneil@outlook.com http://codocent.com @jimoneil http://bit.ly/Win81Themes http://bit.ly/Win81Themes