Skip to content

Commit

Permalink
Merge pull request #178 from symbiogenesis/tapped-command-hotfix
Browse files Browse the repository at this point in the history
fix RowTappedCommand gesture recognizers from blocking UI
  • Loading branch information
symbiogenesis committed May 2, 2024
2 parents d4bdf1a + 60f7d25 commit 966d26a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 1 addition & 5 deletions Maui.DataGrid/DataGrid.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@
SelectionMode="{Binding SelectionMode, Source={Reference self}}">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="x:Object">
<local:DataGridRow DataGrid="{Reference self}" RowToEdit="{Binding RowToEdit, Source={Reference self}}" HeightRequest="{Binding RowHeight, Source={Reference self}, Mode=OneTime}" >
<local:DataGridRow.GestureRecognizers>
<TapGestureRecognizer Command="{Binding RowTappedCommand, Source={x:Reference self}}" CommandParameter="{Binding .}" />
</local:DataGridRow.GestureRecognizers>
</local:DataGridRow>
<local:DataGridRow DataGrid="{Reference self}" RowToEdit="{Binding RowToEdit, Source={Reference self}}" HeightRequest="{Binding RowHeight, Source={Reference self}, Mode=OneTime}" />
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
Expand Down
6 changes: 5 additions & 1 deletion Maui.DataGrid/DataGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,11 @@ private void OnColumnsChanged(object? sender, NotifyCollectionChangedEventArgs e

private void OnRefreshing(object? sender, EventArgs e) => _refreshingEventManager.HandleEvent(this, e, nameof(Refreshing));

private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e) => _itemSelectedEventManager.HandleEvent(this, e, nameof(ItemSelected));
private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
_itemSelectedEventManager.HandleEvent(this, e, nameof(ItemSelected));
RowTappedCommand?.Execute(e);
}

private void OnItemsSourceCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
Expand Down

1 comment on commit 966d26a

@MichelePannacciTerex
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, looks like now RowTappedCommand stopped working in v4.0.4, had to revert, unless I'm missing something

Please sign in to comment.