I'm trying to set some HTML content in the Text of a Tab Item (to use Bootstrap badge styles). When I use MarkupString it is just still rendering as escaped HTML in the control (same function renders correctly outside of Radzen control). Is there additional escaping happening?
Example would be: RadzenTabsItem Text="@RenderBadgeCount(15)"
where RenderBadgeCount is:
public MarkupString RenderBadgeCount(int count)
{
var badge = String.Format($"{count.ToString()}");
return new MarkupString(badge);
}
What I'm trying to do now I'm curious what the Radzen pattern might be. When the tab is selected I want the RenderBadgeCount function to return a different styled HTML depending on if the tab is selected or not. Change/SelectedIndexChanged only are giving me an int and not any object within that I can re-render. I may be thinking about this totally wrong from my WebForms days -- any thoughts appreciated.
Basically when RenderBadgeCount is called I need to know if the tab is selected or not to render a diff style attribute.
Indeed that would be hard to do if you don't know that tab's index. At the moment all helpful methods and properties are internal. We will expose some of them e.g. the Index property of the item.
I just started a separate topic on this too. Selected is exposed but doesn’t seem to be updating with internal _IsSelected. Having that corrected as well as exposing Index would be good.
We released Radzen.Blazor 2.17.7 where the IsSelected and Index property of the RadzenTabsItem are public. You can use IsSelected to determine if the item is selected in the template: