Question

I created a custom part called PresentationPart and its placed.

In the placement.info I have

<Match ContentType="Presentation">
    <Match DisplayType="Summary">
        <Place Parts_PresentationPart_Summary="Content:after"/>
    </Match>
    <Match DisplayType="Detail">
        <Place Parts_PresentationPart="Content:after"/>
    </Match>
</Match>

The folder layout is

Views ->
    EditorTemplates ->
        Parts ->
            Parts_PresentationPart.cshtml   
    Parts ->
         Parts_PresentationPart.cshtml
         Parts_PresentationPart.Summary.cshtml

The view Parts_PresentationPart_Summary is never used (attempting to have summary display in list view).

If I modify Placement.info's Presentation Summary match area to be

<Match DisplayType="Summary">
    <Place Parts_PresentationPart="Content:before"/>
    <Place Parts_PresentationPart_Summary="Content:after"/>
</Match>

The normal view will display.

What is required to get the summary view to display? Or is there something I am completely skipping?

edit: I'd skipped the CombinedResult in the display driver.

Original:

protected override DriverResult Display(PresentationPart part, string displayType, dynamic shapeHelper)
{
    return ContentShape("Parts_PresentationPart",() => shapeHelper.Parts_PresentationPart(ContentItem: part.ContentItem, Name: part.Name)));
}

So what I'll need is something like this?

var driverResults = new List<DriverResult>();
driverResults.Add(ContentShape("Parts_PresentationPart", () => shapeHelper.Parts_PresentationPart(ContentItem: part.ContentItem, Name: part.Name)));
driverResults.Add(ContentShape("Parts_PresentationPart_Summary",() => shapeHelper.Parts_PresentationPart(ContentItem: part.ContentItem, Name: part.Name)));
return new CombinedResult(driverResults);
Was it helpful?

Solution

Treat the "normal" and "summary" shapes as totally separate ones. That being said you should simply not show the "normal" one when displaying the Summary (and vice versa):

<Match DisplayType="Summary">
    <Place Parts_PresentationPart="-"/>
    <Place Parts_PresentationPart_Summary="Content:after"/>
</Match>

You haven't posted the driver Display method, so I'm not sure what you are returning from it...

For this scenario to work you should return the CombinedResult with both the normal and "summary" shapes inside. The display manager could then decide which one to display based on the data stored in Placement.info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top