In code, how can I access the current Page Design
my Page is using?
Tried to find something in the RenderingReference
no luck.
That is quite simple, you need to use PresentationContext
service. Here is an example:
ServiceLocator.ServiceProvider.GetService<IPresentationContext>().GetDesignItem(CONTEXT_ITEM);
It will do all the work your you:
You can also inject PresentationContext
using constructor injection like this:
public class MyClass
{
protected readonly IPresentationContext PresentationContext;
public MyClass(IPresentationContext presentationContext)
{
PresentationContext = presentationContext;
}
}