Comments (1)
We have checked your requirement , we would like to let you know , we would like to inform you that within the Android platform, touch events are not relayed to the parent view when a child view contains gesture recognizers, as this is standard behavior within the framework. Hence we modified sample with customview, which have gesture and passes the touch to the parent item , Please have look at the sample , Added the customview inside the ItemTemplate , here you can use the GestureRegonizer instead of command in local:ContactCard , Please have a look at the sample and let us know if you have any concerns.
CustomClass.cs
#if ANDROID
public class CustomContentView : ContentView, ITapGestureListener,IDoubleTapGestureListener,ILongPressGestureListener,ITouchListener
#else
public class CustomContentView : ContentView
#endif
{
public CustomContentView()
{
#if ANDROID
this.AddGestureListener(this);
this.AddTouchListener(this);
#endif
}
// Invoke SfListView's ItemTapped , ItemDoubleTapped and ItemLongPress events through ContentView gestures since,
// touch won't passes to parent view in Android platform when child view has gesture recognizers.
void ITapGestureListener.OnTap(TapEventArgs e)
{
var parent = this.GetParent(this);
if (parent is ListViewItem)
{
(parent as ListViewItem).OnTap(e);
}
}
void ITouchListener.OnTouch(Syncfusion.Maui.Core.Internals.PointerEventArgs e)
{
var parent = this.GetParent(this);
if (parent is ListViewItem)
{
(parent as ListViewItem).OnTouch(e);
}
}
void IDoubleTapGestureListener.OnDoubleTap(TapEventArgs e)
{
var parent = this.GetParent(this);
if (parent is ListViewItem)
{
(parent as ListViewItem).OnDoubleTap(e);
}
}
void ILongPressGestureListener.OnLongPress(LongPressEventArgs e)
{
var parent = this.GetParent(this);
if (parent is ListViewItem)
{
(parent as ListViewItem).OnLongPress(e);
}
}
internal object GetParent(object currentView)
{
while (currentView != null && currentView.GetType() != typeof(ListViewItem))
{
return this.GetParent((currentView as Element).Parent);
}
return currentView;
}
}
In XAML
<syncfusion:SfListView x:Name="listView" Grid.Row="1" ScrollBarVisibility="Never"
ItemSize="60"
AllowSwiping="True"
BackgroundColor="#FFE8E8EC"
ItemsSource="{Binding ToDoList}"
DragStartMode="OnDragIndicator,OnHold"
ItemTapped="listView_ItemTapped"
SelectionMode="None">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<local:CustomContentView>
<local:CustomContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</local:CustomContentView.GestureRecognizers>
<Grid x:Name="rootGrid" Padding="10" BackgroundColor="Beige">
<Label Text="{Binding Name}"/>
</Grid>
</local:CustomContentView>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
from maui-demos.
Related Issues (20)
- Syncfusion SchedulerAppointment endless loop after setting Value to Notes HOT 2
- NullReferenceException Getting Started.docx HOT 2
- Won't build? HOT 8
- Documentation links are broken HOT 2
- Can't run on Mac Monterey M1 HOT 8
- maui out of preview
- [Maui] [IOS] - Avatar View Control - Out HOT 1
- SfTabItem: LineBreakMode and Spacing options HOT 2
- Uncaught TypeError: Cannot read properties of null (reading 'innerHTML') HOT 1
- [Windows] ComboBox crash application HOT 1
- AutoComplete ItemTemplate HOT 2
- Can't access object property of SelectedItem HOT 1
- More examples with C# markup HOT 2
- Problems with exporting datagrid to excel.
- PdfView not compileable HOT 1
- [iOS] Slow when clicked
- MSIX Crash on startup
- Running examples
- Issue with SfSignaturePad in iOS Unable to Sign When ScrollView is Active HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maui-demos.