public WindowChrome()
{
// Effective default values for some of these properties are set to be bindings
// that set them to system defaults.
// A more correct way to do this would be to Coerce the value iff the source of the DP was the default value.
// Unfortunately with the current property system we can't detect whether the value being applied at the time
// of the coersion is the default.
foreach (var bp in _BoundProperties)
{
// This list must be declared after the DP's are assigned.
Assert.IsNotNull(bp.DependencyProperty);
BindingOperations.SetBinding(
this,
bp.DependencyProperty,
new Binding
{
#if NET45
Path = new PropertyPath("(SystemParameters." + bp.SystemParameterPropertyName + ")"),
#else
Source = SystemParameters2.Current,
Path = new PropertyPath(bp.SystemParameterPropertyName),
#endif
Mode = BindingMode.OneWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
});
}
}