XamlC resolves x:DataType incorrectly
See original GitHub issueDescription
This is partly a collection of issues and partly a more specific issue. Not sure if this is 100% a bug in all cases either.
XamlC uses the x:DataType="<type-name>" on <DataTemplate> to generate type-specific bindings, however, somce times the scope is incorrect or if the XAML is wrong but happens to match there is no exception and just fails silently.
In debug you can also get these errors using
<_MauiForceXamlCForDebug>true</_MauiForceXamlCForDebug>but still no warnings or exceptions anywhere.
Steps to Reproduce
- Clone https://github.com/mattleibow/maui-bug-repros/tree/repro-xamlc-datatype
- Run
- Observe that not all the collection views have items in them
Link to public reproduction project repository
https://github.com/mattleibow/maui-bug-repros/blob/repro-xamlc-datatype/MauiApp1/MainPage.xaml
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS, Other (Tizen, Linux, etc. not supported by Microsoft directly)
Affected platform versions
All versions
Did you find any workaround?
Make sure the x:DataType is specified correctly, and on every level of templates.
Relevant log output
No response
Issue Analytics
- State:
- Created 9 months ago
- Reactions:3
- Comments:9 (2 by maintainers)

Top Related StackOverflow Question
Can you give some love (priority) to this issue (I created a duplicated one yesterday the one @mattleibow mentioned) ?
From what I see Compiled bindings don’t actually work as compiled bindings in MAUI and this issue is 3 months old
Thanks
Bump