Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Listview Item background colour change when long press for Android.

$
0
0

I am trying to change the background color of list item when long-press of it, but existing color coding is not allowing.
I added styles in Android everything is working if I remove my default background, but default background color should be there as per UX.
Here is my code,

<DataTemplate x:Key="ResourceDataTemplate">
        <ViewCell BindingContextChanged="Resource_BindingContextChanged">
            <StackLayout Spacing="0" BackgroundColor="#fffff">
                <Grid.RowDefinitions>

                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <StackLayout BackgroundColor="{Binding BgColor}" Style="{StaticResource GeneralPaddingStackLayoutStyle}" Orientation="Vertical" Spacing="0">
                    <Label Text="{Binding LinkName}" Style="{StaticResource titleLabel}" LineBreakMode="TailTruncation">
                        <Label.GestureRecognizers>
                            <TapGestureRecognizer Tapped="Label_Tapped" CommandParameter="{Binding .}" />
                        </Label.GestureRecognizers>
                    </Label>
                    <customRenderPage:TwoLineLabel Text="{Binding Description}" Style="{StaticResource subTitleLabel}" Margin="{StaticResource defaultTopPaddingforTitle}" />
                </StackLayout>
                <usercontrols:SeparatorGrid Grid.Row="1" />
            </StackLayout>
        </ViewCell>
    </DataTemplate>`

If I remove background color from this line "<StackLayout Spacing="0" BackgroundColor="#fffff">", it's working fine. Otherwise white color overriding the highlighted color, how to overcome this.
Thanks in advance.


Viewing all articles
Browse latest Browse all 204402


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>