Hi! Thanks for reading this.
I'm trying to change StackLayout Background Color for some items inside a ListView. I use this background color for some special items inside de listview.
Here's my xaml.
<ListView x:Name="lst" ItemsSource="{Binding ListSource}" ItemSelected="lst_ItemSelected" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout x:Name="Back" Padding="10" Margin="10" BackgroundColor="{Binding BackgroundColor}" Orientation="Horizontal">
<Label Text="{Binding Texto}" TextColor="White" />
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
ListSource model has a BackColor property, so, some items have Gray background color, and others just keep transparent.
When an item is selected , there is no problem with transparent ones, but red replaces selected color.
So, I would like when one item was selected, if it has a gray background color then it must to change to transparent, and return to gray when lost selection.
I have been try with a ContentView , for extract DataTemplate to another xaml getting access to StackLayout, and tried a lot of examples that I found on internet. Nothing worked.
Thanks in advance.
Gaston.