Xaml cell:
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:xamarinLibrary="clr-namespace:XamarinLibrary;assembly=XamarinLibraryNS" BindingContextChanged="ViewCell_BindingContextChanged"
<ViewCell.View> <StackLayout Orientation="Horizontal" Margin="1" Padding="2" BackgroundColor="#ffffffff"> <Grid VerticalOptions="Center"> <Grid.ColumnDefinitions> <ColumnDefinition Width="34"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <ffimageloading:CachedImage x:Name="imageDetail" Source="{Binding imageDetailIcon}" IsVisible="{Binding VisibleDetailIcon}" WidthRequest="30" HeightRequest="30" HorizontalOptions="Center" Grid.Column="0" Grid.Row="0"> </ffimageloading:CachedImage> <ffimageloading:CachedImage x:Name="imageSummary" Source="summary.png" IsVisible="{Binding VisibleSummary}" WidthRequest="26" HeightRequest="36" HorizontalOptions="Center" Grid.Column="0" Grid.Row="0"> </ffimageloading:CachedImage> <Label x:Name="lIndex" Text="{Binding IndexDisplay}" IsVisible="{Binding VisibleIndex}" TextColor="Black" FontSize="18" LineBreakMode="TailTruncation" HorizontalOptions="Center" Grid.Column="0" Grid.Row="1"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> </Grid> <Grid HorizontalOptions="FillAndExpand"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*"/> <ColumnDefinition Width="40"/> </Grid.ColumnDefinitions> <StackLayout x:Name="slLabel" Orientation="Vertical" VerticalOptions="Center" Grid.Column="0" Spacing="1"> <Label x:Name="l0" Text="slLabel" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation" HorizontalOptions="StartAndExpand"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="l1" Text="slLabel" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation" HorizontalOptions="StartAndExpand"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="l2" Text="slLabel" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation" HorizontalOptions="StartAndExpand"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="l3" Text="slLabel" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation" HorizontalOptions="StartAndExpand"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="l4" Text="slLabel" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation" HorizontalOptions="StartAndExpand"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> </StackLayout> <StackLayout x:Name="slValue" Orientation="Vertical" VerticalOptions="Center" Grid.Column="1" Spacing="1"> <Label x:Name="v0" Text="slValue" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="v1" Text="slValue" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="v2" Text="slValue" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="v3" Text="slValue" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> <Label x:Name="v4" Text="slValue" TextColor="#000000" FontSize="14" LineBreakMode="TailTruncation"> <Label.FontFamily> <OnPlatform x:TypeArguments="x:String" iOS="Roboto Condensed" Android="RobotoCondensed-SK-Regular.ttf#Roboto Condensed"/> </Label.FontFamily> </Label> </StackLayout> <xamarinLibrary:AnimatedButton x:Name="buttomToMap" ImageButton="SwipeTrackBlue.png" WidthRequest="40" ImageButtonHeight="30" ImageButtonWidth="30" Margin="0" HorizontalOptions="Center" VerticalOptions="Fill" Grid.Column="2"/> </Grid> </StackLayout> </ViewCell.View>
In the ViewCell_BindingContextChanged event, the Texts are set in Labels of l0, l1, l2, l3, l4, v0, v1, v2, v3, v4.
Label lIndex does not scale correctly when scrolling through the list.
It helps only if in the ViewCell_BindingContextChanged event call ForceUpdateSize () ;.
Then the displaying of the cell becomes correct.
Please tell me what could be the problem?
This behavior began after updating to Xamarin.Forms 4.0.0.425677.
Before that, there were no such problems.
Further update did not decide the problem.
In iOS everything works fine, the problem occurs only in Android.
Xaml ListView:
<ListView x:Name="listView" Refreshing="listView_Refreshing" IsPullToRefreshEnabled="True" Margin="0" HasUnevenRows="True" BackgroundColor="Transparent" CachingStrategy="RecycleElement" ItemTapped="listView_ItemTapped" VerticalOptions="FillAndExpand" SeparatorVisibility="None" Grid.Row="2"> <ListView.ItemTemplate> <DataTemplate> <local:DetailCell/> </DataTemplate> </ListView.ItemTemplate> </ListView>
↧
The error displaying ViewCell in Android.
↧