From 13725790c11cc168386646c58ca720860b89be6b Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Sat, 24 Aug 2024 16:31:34 +0200 Subject: [PATCH] [DataGrid] Invoke OnRowClick from HandleOnRowKeyDownAsync (#2577) --- .../Microsoft.FluentUI.AspNetCore.Components.xml | 6 +++--- .../Components/DataGrid/FluentDataGridRow.razor.cs | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml index 028eca3ade..c353903fe4 100644 --- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml +++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml @@ -3345,7 +3345,7 @@ - Gets or sets if a dialog is visible or nt (Hidden) + Gets or sets if a dialog is visible or not (Hidden) @@ -3406,7 +3406,7 @@ Gets or sets the height of the dialog. Must be a valid CSS height value like "600px" or "3em" Only used if Alignment is set to "HorizontalAlignment.Center" - + @@ -3440,7 +3440,7 @@ - Gets whether the secondary button is displayed or not. Depends on SecondaryAction having a value. + Gets whether the secondary button is displayed or not. Depends on SecondaryAction having a value. diff --git a/src/Core/Components/DataGrid/FluentDataGridRow.razor.cs b/src/Core/Components/DataGrid/FluentDataGridRow.razor.cs index bfcd3de9e6..c17580ed54 100644 --- a/src/Core/Components/DataGrid/FluentDataGridRow.razor.cs +++ b/src/Core/Components/DataGrid/FluentDataGridRow.razor.cs @@ -137,8 +137,14 @@ internal async Task HandleOnRowKeyDownAsync(string rowId, KeyboardEventArgs e) return; } - var row = GetRow(rowId, r => r.RowType == DataGridRowType.Default); - if (row != null) + var row = GetRow(rowId); + + if (row != null && Owner.Grid.OnRowClick.HasDelegate) + { + await Owner.Grid.OnRowClick.InvokeAsync(row); + } + + if (row != null && row.RowType == DataGridRowType.Default) { foreach (var column in Owner.Grid._columns) {