PresentationViewsSubjectGetPresentation Method

Gets the PresentationElements that display a given domain model element.

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

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



Return Value


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.

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) {...}
Return to top