What Changed
The HeaderTemplate property changed its type from RenderFragment to RenderFragment<IPopupElementInfo>.
Reasons for Change
We decided to pass the IPopupElementInfo object as the context
parameter for this template. The parameter contains an API that can be useful when customizing headers. For instance, you can use context.CloseCallback
to implement a Close button.
Impact on Existing Apps
This change affects applications in the following cases:
- If you use the Popup component and another templated component (declare one within the other). The following error occurs: "…The child content element 'ChildContent' of component 'X' uses the same parameter name ('context') …"
Razor<DxPopup ...>
<HeaderTemplate>
<DxFormLayout>
@*...*@
<DxFormLayoutItem>
<Template>
<DxButton Click="OnClick" Text="OK"></DxButton>
</Template>
</DxFormLayoutItem>
</DxFormLayout>
</HeaderTemplate>
</DxPopup>
- If you create the
HeaderTemplate
in C# code instead of markup.
Razor<DxPopup HeaderTemplate="@CreateTemplate()" ...>
@*...*@
</DxPopup>
@code {
public RenderFragment CreateTemplate() {
return x => @<p>My Text</p>;
}
How to Update Existing Apps
- If you nest the Popup and another templated component, specify the
Context
parameter explicitly in one of them.
Razor<DxPopup ...>
<HeaderTemplate Context="PopupContext">
<DxFormLayout>
@*...*@
<DxFormLayoutItem Context="ItemContext">
<Template>
<DxButton Click="OnClick" Text="OK"></DxButton>
</Template>
</DxFormLayoutItem>
</DxFormLayout>
</HeaderTemplate>
</DxPopup>
- If you create the header template in C# code, use the RenderFragment<IPopupElementInfo> type instead of RenderFragment.
Razor<DxPopup HeaderTemplate="@CreateTemplate()" ...>
@*...*@
</DxPopup>
@code {
public RenderFragment<IPopupElementInfo> CreateTemplate() {
return x => @<p>My Text</p>;
}