Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

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


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" ?>

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

    <local:ItemTemplateSelector x:Key="viewInListTemplateSelector"
          DefaultnDataTemplate="{StaticResource DefaultDataTemplate}"
          NoteDataTemplate="{StaticResource NoteDataTemplate}" 
            <RowDefinition />

        ItemsSource="{Binding LTItems}"
        SelectedItem="{Binding SelectedLTI}"
        ItemTemplate="{StaticResource viewInListTemplateSelector}"

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.