XamlCSS.WPF 2.2.0-pre1

This is a prerelease version of XamlCSS.WPF.
There is a newer version of this package available.
See the version list below for details.
dotnet add package XamlCSS.WPF --version 2.2.0-pre1                
NuGet\Install-Package XamlCSS.WPF -Version 2.2.0-pre1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XamlCSS.WPF" Version="2.2.0-pre1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XamlCSS.WPF --version 2.2.0-pre1                
#r "nuget: XamlCSS.WPF, 2.2.0-pre1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XamlCSS.WPF as a Cake Addin
#addin nuget:?package=XamlCSS.WPF&version=2.2.0-pre1&prerelease

// Install XamlCSS.WPF as a Cake Tool
#tool nuget:?package=XamlCSS.WPF&version=2.2.0-pre1&prerelease                

XamlCSS

Style Xaml-applications with CSS - get it for WPF, Xamarin.Forms or UWP and start right here!

Why XamlCSS For XAML?

Concise

Styling with (s)css gives a more concise declaration of your styles. XamlCSS even supports a subset of SCSS features like selector nesting, css-variables and mixins. This enables you to make your declarations even more concise.

Freely Combine Styles

Other than vanilla Xaml-styles, css allows you to freely combine styles - no BasedOn restriction. Even better, this is done for you behind the curtains!
And if you really want to combine styles yourself use @extend.

Semantic Meaning

Semantic meaning can be conveyed, i.e. is your ui-element important, a warning, a header or a sub-header? This is achieved by using css-classes.

Based On View-Hierarchy

Css takes into account where inside your view-hierarchy your element gets added. No need to manually assigning a style.
It also detects that an element was added or removed.
In combination with semantic selectors you can style a button differently just because it is in a warning dialog. And if you want to create a dark, a light and a custom theme, just switch the css-class-name on your root view-element and all elements update themselves automatically.

Support For Xaml-Features

You can use markup-extensions and triggers in your (s)css.

In css you cannot declare an instance of an object as you can do in xaml. A Storyboard for example must be declared as usual in a ResourceDictionary but then can be referenced in css with a markup-extension.

Designer Support

XamlCSS builds on top of the native Xaml-Style implementations, so it works with the WPF and UWP designer. For Xamarin.Forms there is LiveXAML.

Supported platforms

Supported Features

  • CSS selectors
  • Remove and reapply styles
  • Detect new elements and apply matching styles
  • Support Binding * (except vanilla UWP)
  • Support StaticResource *
  • Support DynamicResource * (except vanilla UWP)
  • Set simple values like Foreground, FontSize, FontStyle,... by CSS
  • Triggers
  • Multiple StyleSheets
  • Nested selectors (like Sass)
  • Css-variables
  • Import of other css-files
  • Mixins

Not (yet) supported

  • Visual State Manager

For more information look at the provided test-apps in the solution to see how to initialize and use XamlCSS.

*) Breaking change in binding syntax in 2.0.0: instead of {Binding value} you now write #Binding value or "{Binding value}"

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.0 is compatible.  netstandard1.1 was computed.  netstandard1.2 was computed.  netstandard1.3 was computed.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
.NETPlatform dotnet is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wp8 was computed.  wp81 was computed.  wpa81 was computed. 
Windows Store netcore was computed.  netcore45 was computed.  netcore451 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.1-pre2 500 5/1/2020
2.2.1-pre1 469 4/4/2020
2.2.0 1,751 2/10/2019
2.2.0-pre7 745 9/5/2018
2.2.0-pre6 683 8/31/2018
2.2.0-pre5 852 5/12/2018
2.2.0-pre4 780 5/6/2018
2.2.0-pre3 926 5/1/2018
2.2.0-pre2 773 4/30/2018
2.2.0-pre1 840 2/11/2018
2.1.0 1,325 12/9/2017
2.0.1 1,077 7/23/2017
2.0.0 1,057 5/21/2017
2.0.0-pre1 858 2/9/2017
1.0.6 1,052 1/22/2017
1.0.5 993 1/21/2017
1.0.4 1,064 12/18/2016
1.0.3 1,034 11/29/2016
1.0.2 1,048 11/29/2016
1.0.1 992 11/22/2016
0.9.0-beta-1 776 9/10/2016
0.9.0-alpha-5 844 6/27/2016
0.9.0-alpha-4 827 6/26/2016
0.9.0-alpha-3 825 6/24/2016
0.9.0-alpha-2 849 6/17/2016
0.9.0-alpha 879 5/22/2016
0.8.0 1,078 5/21/2016
0.8.0-beta-3 843 5/18/2016
0.8.0-beta 1,301 5/16/2016

2.2.0-pre1
           - #52 Attributes Cannot Be Matched - One-Time Matching
           - #53 Asterisk Selector Has Wrong Specificity
           - #54 String Value Throws Exception In Property- And DataTriggers
           - #59 Preview-Friendly Basing StyleSheets On Others
           - #62 Variable Cannot Reference Another Variable
           - #64 Support Xml-Namespace mapping
           - #65 Remove AngleSharp Dependency
           
           2.1.0
           - #39 Ampersand Could Be Anywhere in Selector
           - #40 Support @extend
           - #42 WPF: Sometimes Skips Styling of Button Content
           - #43 Wrong Selector Generated When Using Ampersand In The Middle Of Selector
           - #44 DataTriggers: Support Custom Markup-Extension-Expressions
           - #45 DataTriggers: Support Variables In Markup-Expressions And Values
           - #46 PropertyTriggers: Support Variables In Value-Expressions
           - #48 Support Parsing Floating Point Numbers Without Leading Zero
           - #49 Support Import Of Css Stored In Application.Resources
           - #50 Css-Parser: Parser Hangs If Document Only Contains "At" Character

           2.0.1
           - #36 Fixed "XamlCSS does not support unicode escapes"

           2.0.0
           - #29 Support comments
           - #30 Support enter/exit trigger actions
           - #31 Better error information
           - Rewritten tokenizer, css-parser (performance, maintainability)
           - Better markup-extension parsing
           - Fixed same selector property overrides
           - Support namespaces in markup-extensions

           2.0.0-pre1
           - #11 Nested selectors, css-variables
           - #23 Css imports
           - #24 Sass-like mixins
           - #27 Support triggers (property, data, event)
           - #28 Fixed bracket parsing

           1.0.6
           - #20 Performance: Selectors are parsed too often

           1.0.5
           - #16 WPF: Resource FontFamily doesn't work in Css
           - #19 Decimal Number not parsed correctly
           - #18 Class not properly parsed in grouped selectors
           - #13 CSS-Parser: Broken String-Literal Handling

           1.0.4
           - Css namespacing support fixed
           - Flickering when control added to view

           1.0.3
           - Fixed NullReferenceException

           1.0.2
           - Xaml-Designer Preview support
           - CssParser Tokenizer fixed
           - Better Logical-/Visual-Tree handling

           1.0.1
           - Define stylesheet in Xaml-files with css text
           - Fixed selector specificity

           1.0.0
           - Performance/memory improvements: Caching dom-elements, dom-children,...
           - Batch-Rendering
           - Define stylesheet in Xaml-files with css text
           - Fixed selector specificity

           0.9.0-beta-1
           - Added better css-quotes support
           - Support modal pages
           - fixed bool value support
           - Fixed VisualTreeCell.Include="true"
           - Performance improvement
           - AngleSharp 0.9.8

           0.9.0-alpha-5
           - Fix partial updates: not finding all parents while executing css-parser

           0.9.0-alpha-3
           - Support more general UI types

           0.9.0-alpha
           - experimental support for MarkupExtensions

           0.8.0
           - Support for attached properties
           - Support for CSS-namespaces