In this article I will continue implementing page preview in ContentArea. I already have custom view which renders current page in ContentArea. The item could look better when it’s surrounded by two fake items. It will give the feeling of how the page will look like together with other elements. That’s why I decided to prepare ContentArea with fake items.
ContentArea with fake items

ContentArea has generic collection of ContentAreaItem. Main item property is ContentLink. I didn’t wanted to create a custom content provider which returns fake content, so I tried to find other solution. ContentArea has also Fragments property which expose virtual GetContent method.
I’ve implemented FakeStringFragment which extend default ContentArea ContentFragment. The GetContent method is overriden and instead of returning Content using ContentReference the fake News Page is always created.
I also changed the GetSecurityDescriptor method implementation, because by default item would be filtered out in ContentArea.FilteredItems property.

Now using newsPage.MainContentArea.Fragments.Add(CreateFakeFragment(contentAreaItem)) I created two fake items.

The fake items could be faded. It allows editor to focus on current page item. That’s why first and last elements have added opacity in styles.

using fake ContentArea items

The full source code for last three articles is available on Gist