The code bellow shows some validation messages inside a Border. When I'm trying it from debug (using the same device) it's working well, but when I deploy it, download from play store and try use it, the text space is filled with blank space. I know the binding list is well filled from code behind because if the list is long as well the space is long too, but the text don't shown.
The content of the other span (<Span Text="{x:Static res:Strings.orderbatchsent_statusinvalidorder}" />
) works well. The problem occours only inside the CollectionView.
<Border IsVisible="{Binding ShowPreValidationMessages}" BackgroundColor="{AppThemeBinding Default={StaticResource redColor}}"
Margin="0,2"
Padding="10,10"
Grid.Row="4"
Grid.ColumnSpan="2"
StrokeShape="RoundRectangle 2">
<Grid RowDefinitions="{OnPlatform Android='*,*,*', iOS='Auto,*,*'}">
<Label Grid.Row="1"
VerticalTextAlignment="Center">
<Label.FormattedText>
<FormattedString>
<Span Text="{x:Static res:Strings.orderbatchsent_statusinvalidorder}" />
</FormattedString>
</Label.FormattedText>
</Label>
<CollectionView ItemsSource="{Binding ValidationMessagesList}"
Grid.Row="2">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label Margin="0,5,0,0" Grid.ColumnSpan="2" VerticalTextAlignment="Center">
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding .} "/>
</FormattedString>
</Label.FormattedText>
</Label>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
As mentioned in the comments, it's highly recommended to set the correct x:DataType
for all DataTemplate
. Incorrect x:DataType
can lead to unpredictable results and even inconsistent results between Debug and Release builds.