In certain scenarios, XamlC should be able to infer the x:DataType based on the value passed to BindingContext on any XAML element or to Source on BindingExtension elements:
Explicitly declared x:DataType should always take precedence over the inferred type. In the case when there is a mismatch, we should consider emitting a warning.
Are there any other cases which we could infer?
/cc @StephaneDelcroix
In certain scenarios, XamlC should be able to infer the
x:DataTypebased on the value passed toBindingContexton any XAML element or toSourceonBindingExtensionelements:{StaticResource X}- in the case whenXis defined in the same XAML document{x:Static Y}{x:Reference Z}{Binding W}- when the binding is compiled{Binding Source={RelativeSource U}}:Self- when the elemet to which the binding is set is statically knownFindAncestorFindAncestorBindingContext- when the ancestor and the type of the binding context can be statically resolvedTemplatedParent- when the templated parent can be statically resolvedExplicitly declared
x:DataTypeshould always take precedence over the inferred type. In the case when there is a mismatch, we should consider emitting a warning.Are there any other cases which we could infer?
/cc @StephaneDelcroix