Referencing Static Fields and Properties
In WPF apps, but not the other types of apps, you can reference static fields and properties with the x:Static keyword. For example, the following Button’s Height is assigned to the value of the SystemParameters.IconHeight property from the System.Windows namespace:
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="{x:Static SystemParameters.IconHeight}"/>
As with x:Type, the specified argument must be qualified with an XML namespace prefix if the member doesn’t belong in the default namespace. In this case, System.Windows is one of the .NET namespaces mapped to http://schemas.microsoft.com/winfx/2006/xaml/presentation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access