Q:

How do you set up a binding to a static property from code-behind? ( WPF 4.5+)

In XAML, setting up a binding to a static property is simple...

<TextBlock Text="{Binding Path=(foo:StaticClass. StaticProperty)}" />

How do you achieve the same thing in code? 
I've tried the following:

var b = new Binding(){
    Path = new PropertyPath(StaticClass. StaticProperty)
};

var b = new Binding(){
    Path = new PropertyPath("StaticClass. StaticProperty")
};

var b = new Binding(){
    Source = StaticClass,
    Path   = new PropertyPath("StaticProperty")
};

...but none of the above work. 
This works to set the initial value, but doesn't update...
var binding = new Binding(){
    Source = StaticClass. StaticProperty
};

The only way I've managed to get it to work so far is like this...
public static Binding CreateStaticBinding(Type classType, string propertyName){

    var xaml = $@"
        <Binding
            xmlns    = ""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
            xmlns:is = ""clr-namespace:{$"{classType. Namespace};assembly={classType. Assembly. GetName().Name}"}""
            Path=""(is:{classType. Name}.{propertyName})"" />";

    return (Binding)System. Windows. Markup. XamlReader. Parse(xaml);
}

...but MAN does that annoy me I have to resort to creating dynamic XAML, then parsing it!  UGH!!  But hey... it works. 
I have to think there's an easier way!  So what is it? 

A:

Create a PropertyPath by xaml paserer is different from constructor of Binding.  So you should use code in below to get it work. 
var binding = new Binding() {
    Path = new PropertyPath(typeof(StaticClass).GetProperty(nameof(StaticClass. StaticProperty))),
};

