J'ai trouvé une erreur lorsque vous sélectionnez un élément tous les arrière-plans des enfants sont modifiés pour la même couleur.Xamarin Forms - Listview sur l'élément sélectionné changer tout l'arrière-plan à la même
Dans tous les éléments, j'ai mis la propriété BackgroundColor. Cela ne se est passé dans l'iOS
Suivez l'exemple du code:
XAML
<ListView
x:Name="ListPainel"
SeparatorColor="#d2d8e2"
SeparatorVisibility="Default"
Margin="0"
ItemsSource="{Binding ListPainel_Source}"
HasUnevenRows="true"
RefreshCommand="{Binding ListPainel_RefreshCommand}"
IsRefreshing="{Binding ListPainel_IsRefreshing}"
>
</ListView>
Une partie de ViewCell
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
dynamic temp = BindingContext;
PainelDto painel = (PainelDto)temp;
...
if(painel.HasDetalhes)
{
Button detalhes = new Button()
{
Text="VER DETALHES",
FontSize = 12,
TextColor = Color.FromHex("#4482ff"),
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Start,
HeightRequest = 20,
WidthRequest = 120,
BackgroundColor = Color.DeepPink
};
detalhes.SetBinding(
Button.CommandProperty
, new Binding(
"ViewDetalhesCommand"
, BindingMode.Default
, null
, null
, null
, _viewModelPainel
)
);
box.Children.Add(detalhes);
}
...
View = box;
}
Quelqu'un sait comment résoudre ce problème?
je change la question. –