Description
When a Binding has both a Converter={StaticResource ...} and is inside a scope with x:DataType, the binding is not compiled (i.e., no TypedBinding is generated). Instead, it falls back to a runtime-interpreted binding.
At runtime, the interpreted binding tries to resolve the StaticResource converter through the standard resource lookup path, which can fail — resulting in a missing resource exception.
Expected Behavior
The binding should be compiled into a TypedBinding (just like bindings without converters), with the converter resolved at runtime via this.Resources["key"].
Actual Behavior
The binding falls back to runtime interpretation and throws:
Resource not found: "SomeConverter"
Steps to Reproduce
- Create a page with
x:DataType set on a parent element
- Add a
Label with Text="{Binding SomeProperty, Converter={StaticResource SomeConverter}}"
- Ensure
SomeConverter is not present in the page Resources
- Build and run — the app crashes
Context
This is a BindingSourceGen limitation — the source generator likely skips bindings with converters because it cannot statically resolve the converter type from a StaticResource reference.
Affected Area
- BindingSourceGen (compiled bindings with converters)
Description
When a
Bindinghas both aConverter={StaticResource ...}and is inside a scope withx:DataType, the binding is not compiled (i.e., noTypedBindingis generated). Instead, it falls back to a runtime-interpreted binding.At runtime, the interpreted binding tries to resolve the
StaticResourceconverter through the standard resource lookup path, which can fail — resulting in a missing resource exception.Expected Behavior
The binding should be compiled into a
TypedBinding(just like bindings without converters), with the converter resolved at runtime viathis.Resources["key"].Actual Behavior
The binding falls back to runtime interpretation and throws:
Steps to Reproduce
x:DataTypeset on a parent elementLabelwithText="{Binding SomeProperty, Converter={StaticResource SomeConverter}}"SomeConverteris not present in the page ResourcesContext
This is a BindingSourceGen limitation — the source generator likely skips bindings with converters because it cannot statically resolve the converter type from a
StaticResourcereference.Affected Area