Skip to content

How can I close an open DetailRow when clicked again? #2489

Answered by GilShalit
GilShalit asked this question in Q&A
Discussion options

You must be logged in to vote

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 trigger

DetailRowTrigger="@((item)=> item.Id == selectedRow?.Id && !isRowAlreadySelected(item))"

The function includes a small hack because of issue #2500:

        myClass selectedRow;
        myClass prevSelectdRow;
        bool secondCall = false;

     bool isRowAlreadySelected(myClass item)
        {//DetailRowTrigger is called twice on each row click so prev is updated only on second call
            bool isRowClicked = prevSelectdRow != null && prevSelectdRow.Id == selectedRow.Id…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by GilShalit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants