Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to disable Highlight on listview in xamarin.forms

$
0
0

Hi all,

I'm working with xamarin forms and xaml, and I'm trying to create an application that store a list of product. I put my list of product in a listView. this work fine.
Here is my xaml
`
<ListView.ItemTemplate>


<ViewCell.View>



          <StackLayout Padding="0, 0, 0, 0"
                       VerticalOptions="Center"
                       HorizontalOptions="FillAndExpand">                
                <Label Text="{Binding Name}"
                   Font="Bold, Medium" />
                <Label Text="{Binding Description}" 
                    Font="Small"/>
          </StackLayout>

          <StackLayout Orientation="Horizontal"
                        Padding="0, 0, 10, 0">
            <Button Text=" - " 
                    HorizontalOptions="EndAndExpand"
                    VerticalOptions="FillAndExpand"
                    Command="{Binding DeleteSushiCommand}"
                    CommandParameter="{Binding Name}"
                    />
            <Label VerticalOptions="Center" 
                   Text="{Binding Number,StringFormat='{0}'}"
                   TextColor="Black"/>
            <Button Text=" + " 
                    HorizontalOptions="EndAndExpand"
                    VerticalOptions="FillAndExpand" 
                    Command="{Binding AddSushiCommand}"
                    CommandParameter="{Binding Name}"
                    />
            </StackLayout>
        </StackLayout>
      </ViewCell.View>
    </ViewCell>
  </DataTemplate>
</ListView.ItemTemplate>

`

I've just the problem that if I click on a cell of my listView, the cell is highlight, and stay highlight. I've try to disable it with this code in the xaml.cs

listSushi.ItemSelected+= (object sender, SelectedItemChangedEventArgs e) => {
                if (e.SelectedItem == null) return; // don't do anything if we just de-selected the row
                // do something with e.SelectedItem
                ((ListView)sender).SelectedItem = null; // de-select the row
            };

But when I touch a cell, now my list is scrolling automatically. It's very strange.
If someone know this bug, or know a fix, you're welcome.
Or if there is a property where I can disable the highlight

thank you

Damien


Viewing all articles
Browse latest Browse all 58056

Trending Articles