-
I am using code similar to the code below to open a DataGrid DetailRow when the row is clicked.
Is there a standard way of closing the DetailRow when the row is clicked if it is already open? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
To show the detail row, a DetailRowTrigger just needs to return DetailRowTrigger="@((item)=>item.Salaries?.Count > 0 && item.Id == selectedEmployee?.Id && someOtherBool)"> <Button Clicked="@OnClicked">
Toggle
</Button>
@code{
bool someOtherBool;
Task OnClicked(){
someOtherBool = !someOtherBool;
return Task.CompletedTask;
}
} |
Beta Was this translation helpful? Give feedback.
-
As is pointed out here: #1705, using Ctrl+Click on a previously clicked row will close it. Not sure this is intuitive enough. |
Beta Was this translation helpful? Give feedback.
-
Just to complete @stsrki's answer, as I needed the click to be associated with the row so it can close the details if already open, I ended up in adding a boolean function
The function includes a small hack because of issue #2500:
|
Beta Was this translation helpful? Give feedback.
Just to complete @stsrki's answer, as I needed the click to be associated with the row so it can close the details if already open, I ended up in adding a boolean function
isRowAlreadySelected(item)
to the triggerThe function includes a small hack because of issue #2500: