dotvvm icon indicating copy to clipboard operation
dotvvm copied to clipboard

Limit content allowed inside ITemplate

Open djanosik opened this issue 7 years ago • 0 comments

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.

djanosik avatar Feb 24 '18 09:02 djanosik