[DataTemplate/CollectionView] : Inconsistent behavior btw Release/Debug config with Xaml -> Bindings not working when x:DataType is not specified in Release mode #20002
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
[Appears on Android, physical and emulator devices]
DataBinding don't seem to fully work in
<DataTemplate></DataTemplate>
ifx:DataType="customenamespace:MyDataModel"
is not explicitely specified as DataTemplate property.More specifically, events are well propagated and properties properly propagate the updates to the code-behind.
However, it seems
DataTemplate
is missing the Type information in release mode (which is conveyed fine in Debug builds).Hence, the controls within the
DataTemplate
tag are bound, but they can't access the data they need to display.This is true for POD and for functions (I had app crashes when clicking on an item of the
CollectionView
in release mode without theDataType
property, probably because the event function couldn't be found).In-situ app demonstration :
With the
DataType
property :Without the DataType property :
Here is the code snippet which is responsible for this :
As you can see, all properties (
Labels
here) are missing from the render.Furthermore, as said, when I click on a card, it normally navigates (with the Shell) to a new page where we can find details about the selected item. This relies on a
RelayCommand
which is bound to the ViewModel.In Debug mode, this works fine.
In Release mode with the
DataType
property, it also works fine.In Release mode without the
DataType
property, it crashes.Steps to Reproduce
Link to public reproduction project repository
https://github.com/bebenlebricolo/DotnetMaui-DataTemplateBug
Version with bug
8.0.6
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Api levels 30 to 34 at least (Android 11 and above)
Did you find any workaround?
Explicitely specify
x:DataType
information asDataTemplate
propertyRelevant log output
No response
The text was updated successfully, but these errors were encountered: