SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Mais de Jim O'Neil

Mais de 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
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

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