ListView - setting of selected item background color doesn't work

Hi,

I am trying to set background color for a selected item in my listview, but it doesn't change to the specified color. Here's my XAML:
`
<?xml version="1.0" encoding="utf-8" ?>

<ContentPage.Resources>
    <DataTemplate x:Key="DefaultDataTemplate">
    </DataTemplate>
    <DataTemplate x:Key="NoteDataTemplate">
        <ViewCell>
            <StackLayout Orientation="Vertical"  HorizontalOptions="Fill" >
                <StackLayout.Resources>
                    <Style TargetType="StackLayout">
                        <Style.Triggers>
                            <Trigger TargetType="StackLayout" Property="IsFocused" Value="True">
                                <Setter Property="BackgroundColor" Value="OrangeRed" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </StackLayout.Resources>
                <Label Text="{Binding Name}" />
                <Label Text="{Binding BssID}" />
            </StackLayout>
        </ViewCell>
    </DataTemplate>

    <local:ItemTemplateSelector x:Key="viewInListTemplateSelector"
          DefaultnDataTemplate="{StaticResource DefaultDataTemplate}"
          NoteDataTemplate="{StaticResource NoteDataTemplate}" 
                                    />
</ContentPage.Resources>
<StackLayout>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
        </Grid.RowDefinitions>
    </Grid>

    <ListView
        VerticalOptions="FillAndExpand" 
        SeparatorColor="Beige"
        ItemsSource="{Binding LTItems}"
        SelectedItem="{Binding SelectedLTI}"
        ItemTemplate="{StaticResource viewInListTemplateSelector}"
        ItemSelected="ListView_ItemSelected"
        >
    </ListView>
</StackLayout>


`
I need to do the change w/o coding i.e. with clean XAML. How can I have it done?

Sign In or Register to comment.