I have a SfListView with an ItemTemplate that contains a SfExpander view. I load the data dynamically. When I try to swipe the ListViewItem with the Expander collapsed it does not work. If I expand the Expander, the swipe works fine. Any ideas?
|
<sflistview:SfListView x:Name="listView"
AutoFitMode="DynamicHeight"
SelectionMode ="None"
IsScrollBarVisible="False"
AllowSwiping="True"
ItemsSource="{Binding ContactsInfo}">
...
<sflistview:SfListView.ItemTemplate>
<DataTemplate>
<expander:SfExpander DynamicSizeMode="Content,Header" InputTransparent="True" IsExpanded="{Binding IsExpanded, Mode=TwoWay}">
<expander:SfExpander.Header>
<Grid x:Name="grid" RowSpacing="0" Padding="0,4,0,0">
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Path=BindingContext.ExpandCommand, Source={x:Reference listView}}"
CommandParameter="{Binding .}"/>
</Grid.GestureRecognizers>
...
</Grid>
</expander:SfExpander.Header>
<expander:SfExpander.Content>
...
</expander:SfExpander.Content>
</expander:SfExpander>
</DataTemplate>
</sflistview:SfListView.ItemTemplate>
</sflistview:SfListView> |
|
public class AccordionViewModel : INotifyPropertyChanged
{
public Command<object> ExpandCommand { get; set; }
public AccordionViewModel()
{
ExpandCommand = new Command<object>(OnExpand);
}
private void OnExpand(object obj)
{
var item = obj as Contact;
item.IsExpanded = !item.IsExpanded;
}
} |