/// <summary> /// Gets the control responsible for rendering content and tries to cast it to <see cref="IBlockControl"/>. /// If the control does not implement this <see cref="IBlockControl"/> we create a wrapper that handles this for us. /// </summary> private static IBlockControl GetIBlockControl(ContentRenderer contentRenderer) { var blockControl = contentRenderer.CurrentControl as IBlockControl; if (blockControl != null) { return(blockControl); } var genericIBlockControlWrapper = new GenericIBlockControlWrapper(); genericIBlockControlWrapper.InnerControl = contentRenderer.CurrentControl; genericIBlockControlWrapper.CurrentData = contentRenderer.CurrentData; genericIBlockControlWrapper.ContentRenderer = contentRenderer; contentRenderer.CurrentControl = genericIBlockControlWrapper; return(genericIBlockControlWrapper); }
/// <summary> /// Gets the control responsible for rendering content and tries to cast it to <see cref="IBlockControl"/>. /// If the control does not implement this <see cref="IBlockControl"/> we create a wrapper that handles this for us. /// </summary> private static IBlockControl GetIBlockControl(ContentRenderer contentRenderer) { var blockControl = contentRenderer.CurrentControl as IBlockControl; if (blockControl != null) { return blockControl; } var genericIBlockControlWrapper = new GenericIBlockControlWrapper(); genericIBlockControlWrapper.InnerControl = contentRenderer.CurrentControl; genericIBlockControlWrapper.CurrentData = contentRenderer.CurrentData; genericIBlockControlWrapper.ContentRenderer = contentRenderer; contentRenderer.CurrentControl = genericIBlockControlWrapper; return genericIBlockControlWrapper; }