Search code examples
xamarin.formsxamarin.androidxamarin.ios

Xamarin.Forms when click on ListView ViewCell background color changed to orange , but not initialized to a color


This is my code

<ListView x:Name="listViewClient"  ItemsSource="{Binding Client}" HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell >


                        <Grid  Margin="10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <BoxView  Grid.Column="0" Color="#84DCC6"/>
                            <StackLayout Grid.Column="1" Padding="20, 10">

                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                <Label Text="Name:" FontSize="16" />
                                <Label FontSize="Medium" Text="{Binding Name}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                    <Label Text="Adress:"  FontSize="16"/>
                                <Label FontSize="Medium" Text="{Binding Adress}" FontAttributes="Bold"/>
                                    </StackLayout>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                    <Label Text="Place:"  FontSize="16"/>
                                    <Label FontSize="Medium" Text="{Binding Place}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>

                                <Frame BorderColor="WhiteSmoke" >
                                    <Grid >

                                    <StackLayout Grid.Column="0">
                                    <Label Text="Mobile:"  FontSize="16"/>
                                    <Label  FontSize="Medium" Text="{Binding Mobile}" FontAttributes="Bold" />
                                    </StackLayout>
                                        <Button Grid.Column="1" Text="Call" Clicked="PovikajPartnerClicked" BackgroundColor="#84DCC6"></Button>
                                    </Grid>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                        <Label Text="Е-mail:"  FontSize="16"/>
                                        <Label FontSize="Medium" Text="{Binding EMAIL}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                        <Label Text="LAW:"  FontSize="16"/>
                                        <Label FontSize="Medium" Text="{Binding LAW}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>

                                <Frame BorderColor="WhiteSmoke
                                       ">
                                    <StackLayout>
                                <Label Text="SECNUM:"  FontSize="16"/>
                                <Label FontSize="Medium" Text="{Binding SECNUM}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>

                            </StackLayout>
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

I dont know from where get that orange background color when i tap on the listview. From the code you can see that i dont have choosed samo backgroud color . Is there a default tap event to make the color orange? I tried everything but cant find is there anyplace i forgot to add a color.


Solution

  • I know this may be a bit late, but I hope it will help someone, Just go your styles.xml file under AppName.Android/Resources/values and inside your Main Theme add the following:

    <item name="android:colorActivatedHighlight">@android:color/transparent</item>