Hi Team!
I am struggling with DialogService AlertOptions TitleContent in Alert function. I am trying to set up an alert dialog with an icon to the left of the title. I am creating RenderFragment for a TitleContent with this code on your demo (Blazor Dialog Component | Free UI Components by Radzen):
@inject DialogService DialogService
<div class="rz-p-12 rz-text-align-center">
<RadzenButton Text="Alert dialog" ButtonStyle="ButtonStyle.Secondary"
Click=@(args => DialogService.Alert("Some message!", "MyTitle", @alertOptions)) />
</div>
@code{
AlertOptions alertOptions = new AlertOptions
{
TitleContent = (dialog) => (builder) =>
{
builder.OpenElement(0, "div");
builder.AddAttribute(1, "style", "display: flex; align-items: center;");
builder.OpenElement(2, "img");
builder.AddAttribute(3, "src", "https://via.placeholder.com/24");
builder.AddAttribute(4, "alt", "Icon");
builder.AddAttribute(5, "style", "margin-right: 8px;");
builder.CloseElement();
builder.OpenElement(6, "span");
builder.AddContent(7, "Custom Title");
builder.CloseElement();
builder.CloseElement();
}
};
}
its result is this:
Am I missing something or using it incorrectly?
Thank You in advance,
Patryk