Dialog closing with "X" button

When closing a radzen dialog with the "x" button then I would like to pass an object back to the component which opened the dialog. Is there a way to do that?
Thank you for your answer.

Hi @radzen_user,

Check this thread for more info:
Return an object from a dialog

Thank you for your quick answer. In your answer there is a function bound to a self-created button's (OK button) click event where you can pass an object because you are calling the DialogService.Close(). In this way I have already used this function. My problem is that I don't know how to bind an event to the "X" which is in the corner of the dialog automatically. I mean I think if I'm clicking on the "X" then the DialodService.Close is called automatically under the hood with passing a null back to the dialog which opened it. Because it happens under the hood I cannot pass an object back this way.
Thank you for your answer.


I set the "ShowClose = false" and made a custom "X" button with return object that I positioned in the corner where the default close button would be.


I did the same. But it would be good to have a solution for this.