What Changed
The DxPopup.CloseButtonClick event changed the delegate type from Action to EventCallback.
Reasons for Change
The Action delegate type could cause errors and inconvenience when the CloseButtonClick event handler contained asynchronous code.
For this delegate type, you also had to call the StateHasChanged method to re-render the Popup after changes. The EventCallback delegate contains a reference to its bound component and calls the StateHasChanged method automatically. So, you no longer need to care about component re-rendering and complicate your code.
Razor<DxPopup HeaderText="Header"
@bind-Visible="@PopupVisible"
CloseButtonClick="@OnCloseButtonClick">
<Content><p>Content</p></Content>
</DxPopup>
@code {
bool PopupVisible { get; set; } = false;
void OnCloseButtonClick() {
PopupVisible = false;
// InvokeAsync(StateHasChanged); You no longer need to call this method.
// ...
}
}
Impact on Existing Apps
This change will affect your application if you handle the CloseButtonClick event in C# code using RenderTreeBuilder (instead of the Razor markup).
C#builder.OpenComponent<DxPopup>(0);
builder.AddAttribute(1, "CloseButtonClick", new Action(OnCloseButtonClick);
How to Update Existing Apps
Handle the event in C# code as shown below.
C#builder.OpenComponent<DxPopup>(0);
builder.AddAttribute(1, "CloseButtonClick", EventCallback.Factory.Create(receiver, OnCloseButtonClick);