dotvvm
dotvvm copied to clipboard
Limit content allowed inside ITemplate
I have a property of type IconBase
allowing users to change icon displayed inside control.
<bp:Alert ...>
<DismissIcon>
<bp:FAIcon Icon="Whatever" />
</DismissIcon>
</bp:Alert>
It works as expected until you need to use the icon multiple times. It will fail because you can't add controls to more than one Children
collection. For example, it happens when the icon is used inside Repeater
.
I would like to use ITemplate
to avoid this issue. But I need to limit content allowed inside the template. Something like this should work:
public ITemplate<IconBase> DismissIcon { get; set; } // do we need Template suffix here?
Another option is to use Func<IconBase>
or some special delegate to make sure it doesn't loo like command. But I am not sure it's a good idea because it feels inconsistent.