PresentationViewsSubject.GetPresentation 方法
获取显示特定域模型元素的 PresentationElements。
命名空间: Microsoft.VisualStudio.Modeling.Diagrams
程序集: Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0(在 Microsoft.VisualStudio.Modeling.Sdk.Diagrams.11.0.dll 中)
语法
声明
Public Shared Function GetPresentation ( _
element As ModelElement _
) As LinkedElementCollection(Of PresentationElement)
public static LinkedElementCollection<PresentationElement> GetPresentation(
ModelElement element
)
参数
- element
类型:Microsoft.VisualStudio.Modeling.ModelElement
返回值
类型:Microsoft.VisualStudio.Modeling.LinkedElementCollection<PresentationElement>
备注
使用此方法从一个域模型元素或关系导航到表示它在用户界面的形状或链接。 除非您进行主要自定义 (DSL,将为每个字段元素的介绍性元素。 有时,则显示初始化时,可能尚未显示元素。 ; 如果未设置字段元素映射为 DSL 定义的字段,类的将不显示元素。
为域特定元素类,字段元素映射指定表示元素的类 –形状或链接。
示例
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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。