TemplateBinding with Converter - what is wrong? TemplateBinding with Converter - what is wrong? wpf wpf

TemplateBinding with Converter - what is wrong?


TemplateBindings only work for dependency properties defined on the control being templated (in a ControlTemplate). You just need to switch this around to be a Binding with a RelativeSource of AncestorType (also, attached properties require parenthesis to be used in a binding):

...<DrawingBrush Viewport="{Binding Path=(local:GameDeskProperties.FieldSize), Converter={StaticResource fieldSizeConverter}, RelativeSource={RelativeSource AncestorType={x:Type Rectangle}}}"...

Edit Updated the RelativeSource binding, as it was not defined inside of a ControlTemplate.