Share via


PresentationViewsSubject.GetPresentation Method

Gets the PresentationElements that display a given domain model element.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)

Syntax

'Declaration
Public Shared Function GetPresentation ( _
    element As ModelElement _
) As LinkedElementCollection(Of PresentationElement)
public static LinkedElementCollection<PresentationElement> GetPresentation(
    ModelElement element
)
public:
static LinkedElementCollection<PresentationElement^>^ GetPresentation(
    ModelElement^ element
)
static member GetPresentation : 
        element:ModelElement -> LinkedElementCollection<PresentationElement> 
public static function GetPresentation(
    element : ModelElement
) : LinkedElementCollection<PresentationElement>

Parameters

Return Value

Type: Microsoft.VisualStudio.Modeling.LinkedElementCollection<PresentationElement>

Remarks

Use this method to navigate from a domain model element or relationship to the shape or link that represents it in the user interface. Unless you have made a major customization to the DSL, there will be one presentation element for each domain element. In some cases while the display is being initialized, there might be no display element. There will be no display element if you have not set a Domain Element Mapping for the domain class in your DSL Definition.

For a specific class of domain element, the Domain Element Mapping specifies the class of the presentation element – a shape or link.

Examples

ExampleElement element = ...;
ExampleShape shape = PresentationViewsSubject.GetPresentation(element).FirstOrDefault() as ExampleShape;
if (shape != null) {...}

// A domain relationship:
ExampleElementReferencesTargets relationship = ...; 
// In the DSL Definition, this relationship is mapped to the following BinaryLinkShape:
ExampleConnector link = PresentationViewsSubject.GetPresentation(relationship).FirstOrDefault() as ExampleConnector;
if (link != null) {...}

.NET Framework Security

See Also

Reference

PresentationViewsSubject Class

Microsoft.VisualStudio.Modeling.Diagrams Namespace