Putting Constants in your XAML File? x:Static Is Your Friend.

Okay, here's the scerario:  You've got a bunch of constants in your code in a static class that you want to reference in your XAML files.  How do you do it?   {x:Static} to the rescue!  Simple and very handy, although not particularly intuitive or well documented.  Below is the syntax for both the code and XAML.  Note that the constant class has its own XML Namespace and corresponding mapping PI in XAML, thus the double QName in the XAML(x:Static c:Constants). 

Code:
using System.Windows;

namespace ConstantSample
{
public static class Constants
{
public const double X = 100;
public const double Y = 50;
}
}

XAML:

<?Mapping XmlNamespace="CodeMapNS" ClrNamespace="ConstantSample" ?>
<Window x:Class="ConstantSample.Window1"
xmlns="https://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="https://schemas.microsoft.com/winfx/xaml/2005"
Text="Constants"
xmlns:c="CodeMapNS"
>
<Grid >
<StackPanel>
<Button Width="{x:Static c:Constants.X}"
Height="{x:Static c:Constants.Y}">
Button
</Button>
</StackPanel>
</Grid>
</Window>