How to get CurrentCell value in DataGrid #6090
Unanswered
ShrutiJaiswal1494
asked this question in
Q&A
Replies: 2 comments 2 replies
-
|
Hi. I created an issue to port this property https://github.com/AvaloniaUI/Avalonia/issues/6095 |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
But it's possible anyway now by traversing visual tree. var focused = FocusManager.Instance.Current;
var currentRow = focused?.FindAncestorOfType<DataGridRow>() ?? myDataGrid.FindDescendantOfType<DataGridRowsPresenter>()
.Children.OfType<DataGridRow>()
.FirstOrDefault(r => r.FindDescendantOfType<DataGridCellsPresenter>()
.Children.Any(p => p.Classes.Contains(":current")));
var item = currentRow?.DataContext;
var currentCell = currentRow?.FindDescendantOfType<DataGridCellsPresenter>().Children
.OfType<DataGridCell>().FirstOrDefault(p => p.Classes.Contains(":current")); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In WPF there is a property called
CurrentCellwhich gives the current cell value of a Datagrid. In Avalonia, I do not see any such property. Is there a way to extract the cell value?Beta Was this translation helpful? Give feedback.
All reactions