Hi,
I have a simple setup.
A data grid, which contains two cells.
A text column and a template column.
The button is bound to a delegate command,
which in turn requests navigation.
Showing a list of items, when the user click edit,
I would navigate to the edit view for the particular record.
The stack trace makes no sense, and is certainly not pointing to an issue in my code,
from what I can see.
at Syncfusion.SfDataGrid.XForms.Droid.VirtualizingCellControlRenderer.OnTouchEvent (Android.Views.MotionEvent e) [0x004bd] in <42c48b3923974f68a643233c437121ed>:0
at Android.Views.View.n_OnTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00010] in /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Views.View.cs:18560
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.48(intptr,intptr,intptr)
The code for the button is just as simple
private async void RequestNavigateToEditItem(Guid? itemId)
{
try
{
if (!itemId.HasValue)
{
return;
}
this.IsBusy = true;
await this.NavigationService.NavigateAsync(name: WellKnownPages.LandingPage); // <----- Exception gets thrown when this is called
}
catch (Exception ex)
{
Crashes.TrackError(ex);
}
finally
{
this.IsBusy = false;
}
}
The Xaml, is super simple still, as I was just getting started
<datagrid:SfDataGrid
x:Name="subscriptionGrid"
ColumnSizer="Star"
AutoGenerateColumns="False"
VerticalOptions="FillAndExpand"
ItemsSource="{Binding Items}">
<datagrid:SfDataGrid.Columns>
<datagrid:GridTextColumn HeaderText="Name"
MappingName="Name" />
<datagrid:GridTemplateColumn MappingName="Id">
<datagrid:GridTemplateColumn.CellTemplate>
<DataTemplate>
<buttons:SfButton
Text="Configure"
TextColor="Blue"
ImageSource="success-icon.png"
ShowIcon="True"
ImageWidth="60"
BorderColor="Transparent"
BackgroundColor="Transparent"
ImageAlignment="Start"
Command="{Binding Source={x:Reference subscriptionGrid}, Path=BindingContext.EditItem}"
CommandParameter="{Binding Id}"/>
</DataTemplate>
</datagrid:GridTemplateColumn.CellTemplate>
</datagrid:GridTemplateColumn>
</datagrid:SfDataGrid.Columns>
</datagrid:SfDataGrid>
The items I am binding to can be simplified to this
public class Item
{
public Guid Id {get;set;}
public string Name {get;set;}
}
I have a list of them through this
public ObservableCollection<Item> Items { get; set; }
The edit item command looks like this
public DelegateCommand<Guid?> EditItem { get; set; }
Which is newed up in the constructor like this
this.EditItem = new DelegateCommand<Guid?>(this.RequestNavigateToEditItem);