Part
A Part is an item in a Diagram's Panel's Layer, corresponding to data representing a node or a link.
Inherits: ContentPresenter
Properties
Adornments : IEnumerable<Adornment>
Get the collection of Adornments associated with this part.
Category : string
Gets a string identifying the kind of Node or Group or Link or the purpose of the Adornment.
ContainingGroups : IEnumerable<Group>
Get a collection of Groups of which this part is a member.
ContainingSubGraph : Group
Get the one Group (a "subgraph") that this part is a member of, if any.
DragOverSnapCellSize : Size
Gets or sets the size of the grid cell used when snapping during a drag.
DragOverSnapCellSpot : Spot
Gets or sets the Spot that specifies what point in the grid cell dragged parts snap to.
DragOverSnapEnabled : bool
Gets or sets whether dragging any parts over this part causes their position to be snapped to grid points.
DragOverSnapOrigin : Point
Gets or sets the snapping grid's coordinates origin or offset.
DropOntoBehavior : DropOntoBehavior
Gets or sets the behavior when the DraggingTool drops the selection after a move or copy.
InDiagramBounds : bool
Gets or sets whether this part is included or is ignored in the computation of the diagram bounds, by ComputeDiagramBounds.
IsBoundToData : bool
This is true if this part is bound to data.
IsDropOntoAccepted : bool
Gets or sets whether the mouse is over this part during a DraggingTool drag and DropOntoEnabled is true.
IsSelected : bool
Gets or sets whether this part is selected.
IsTopLevel : bool
This property is true when this part is not member of any group node nor is it a label node for a link.
LayoutId : string
Gets or sets the Id which identifies the layout(s) in a MultiLayout in which this part participates.
Model : IDiagramModel
Gets the IDiagramModel that holds this part's data.
Panel : DiagramPanel
Gets the DiagramPanel that this part is in.
Reshapable : bool
Gets or sets whether the user may reshape this part.
ResizeAdornmentTemplate : DataTemplate
Gets or sets the DataTemplate used by the ResizingTool when this part is selected.
ResizeCellSize : Size
Gets or sets the multiple used to resize.
ResizeElementName : string
Gets or sets the name of the element that gets a resize adornment when selected.
RotateAdornmentTemplate : DataTemplate
Gets or sets the DataTemplate used by the RotatingTool when this part is selected.
Selectable : bool
Gets or sets whether the user may select this part.
SelectionAdorned : bool
Gets or sets whether the SelectionElement gets a selection adornment when this part is selected.
SelectionAdornmentTemplate : DataTemplate
Gets or sets the DataTemplate used to create the selection adornment for this part when it is selected.
SelectionElement : FrameworkElement
Gets the FrameworkElement that gets a selection adornment when selected and that may be resized/reshaped/rotated.
SelectionElementName : string
Gets or sets the name of the element that gets any selection adornment when selected and that may be resized/reshaped/rotated.
VisualElement : FrameworkElement
Get the root visual element used in the rendering of this part.
Methods
CanCopy() : bool
This predicate is true if the user may copy this part.
Returns: Return true if this part is Copyable, if this part's layer's AllowCopy is true, and if this part's diagram's AllowCopy is true.
CanDelete() : bool
This predicate is true if the user may delete this part.
Returns: Return true if this part is Deletable, if this part's layer's AllowDelete is true, and if this part's diagram's AllowDelete is true.
CanEdit() : bool
This predicate is true if the user may in-place edit the text of this part.
Returns: Return true if this part is Editable, if this part's layer's AllowEdit is true, and if this part's diagram's AllowEdit is true.
CanGroup() : bool
This predicate is true if the user may group this part.
Returns: Return true if this part is Groupable, if this part's layer's AllowGroup is true, and if this part's diagram's AllowGroup is true.
CanMove() : bool
This predicate is true if the user may move this part.
Returns: Return true if this part is Movable, if this part's layer's AllowMove is true, and if this part's diagram's AllowMove is true.
CanPrint() : bool
This predicate is true if the user may print this part.
Returns: Return true if this part is Printable, if this part's layer's AllowPrint is true, and if this part's diagram's AllowPrint is true.
CanReshape() : bool
This predicate is true if the user may reshape this part.
Returns: Return true if this part is Reshapable, if this part's layer's AllowReshape is true, and if this part's diagram's AllowReshape is true.
CanResize() : bool
This predicate is true if the user may resize this part.
Returns: Return true if this part is Resizable, if this part's layer's AllowResize is true, and if this part's diagram's AllowResize is true.
CanRotate() : bool
This predicate is true if the user may rotate this part.
Returns: Return true if this part is Rotatable, if this part's layer's AllowRotate is true, and if this part's diagram's AllowRotate is true.
CanSelect() : bool
This predicate is true if the user may select this part.
Returns: Return true if this part is Selectable, if this part's layer's AllowSelect is true, and if this part's diagram's AllowSelect is true.
FindAncestor``1(Visual)
This static method takes an element and walks up the visual tree looking for an element of type .
- elt
Returns: the if it is of type , or else one of its parent visuals of that type, or else null if no such element was found
FindCommonContainingSubGraph(Part) : Group
Find the group that contains both this part and another one.
- other
Returns: This returns null if the two parts are unrelated in the hierarchy of part membership. If non-null, the result is a Group.
FindDescendant(Predicate<FrameworkElement>) : FrameworkElement
Search the visual tree for this part and return the first one for which the given predicate is true.
- pred
- a predicate of type Predicate<FrameworkElement>
Returns: a FrameworkElement or null
FindNamedDescendant(string) : FrameworkElement
Search the visual tree for this part and return the first one that has a Name exactly matching the given .
- name
Returns: a FrameworkElement, or null
FindTopLevelPart() : Part
Find the top-level Part for this part.
Returns: This may often return itself, and should not return null.
GetAdornment(string) : Adornment
Find an Adornment associated with this part that has a particular category.
- category
- this must be a non-null string
Returns: null if this no such adornment
GetAngle(UIElement) : double
Get the angle of an element in the visual tree of this part.
- elt
- a UIElement, an element in the visual tree of this Part
Returns: an angle in degrees, starting at zero in the direction of the positive X axis
GetCopyable(DependencyObject) : bool
Gets the value of the Copyable attached dependency property.
- d
- the root VisualElement
GetDeletable(DependencyObject) : bool
Gets the value of the Deletable attached dependency property.
- d
- the root VisualElement
GetDragOverSnapCellSize(DependencyObject) : Size
Gets the value of the DragOverSnapCellSize attached dependency property.
- d
GetDragOverSnapCellSpot(DependencyObject) : Spot
Gets the value of the DragOverSnapCellSpot attached dependency property.
- d
GetDragOverSnapEnabled(DependencyObject) : bool
Gets the value of the DragOverSnapEnabled attached dependency property.
- d
GetDragOverSnapOrigin(DependencyObject) : Point
Gets the value of the DragOverSnapOrigin attached dependency property.
- d
GetDropOntoBehavior(DependencyObject) : DropOntoBehavior
Gets the value of the DropOntoBehavior attached dependency property.
- d
GetEditable(DependencyObject) : bool
Gets the value of the Editable attached dependency property.
- d
- the root VisualElement
GetEffectiveSize(FrameworkElement) : Size
Get the actual size of an element, or its desired size if it hasn't been arranged yet, without measuring or arranging the element.
- e
- an element that is in the visual tree of this part
GetElementBounds(FrameworkElement) : Rect
Compute the bounds in model coordinates of a FrameworkElement that is within the visual tree of this part.
- elt
- a FrameworkElement within this part
Returns: a Rect in model coordinates, taking any transforms into account; if the part has not yet been positioned, the (X,Y) position will be (NaN, NaN).
GetElementPoint(FrameworkElement, Spot) : Point
Compute the point in model coordinates of a in a FrameworkElement that is within the visual tree of this part.
- elt
- a FrameworkElement within this part
- spot
- a Spot; if the spot IsNoSpot assume Center instead.
Returns: a Point in model coordinates, taking any transforms into account; if the part has not yet been positioned, the (X,Y) position will be (NaN, NaN).
GetGroupable(DependencyObject) : bool
Gets the value of the Groupable attached dependency property.
- d
- the root VisualElement
GetInDiagramBounds(DependencyObject) : bool
Gets the value of the InDiagramBounds attached dependency property.
- d
- the root VisualElement
GetLayerName(DependencyObject) : string
Gets the value of the LayerName attached dependency property.
- d
- the root VisualElement
GetLayoutId(DependencyObject) : string
Gets the value of the LayoutId attached dependency property.
- d
- the root VisualElement
GetMovable(DependencyObject) : bool
Gets the value of the Movable attached dependency property.
- d
- the root VisualElement
GetPrintable(DependencyObject) : bool
Gets the value of the Printable attached dependency property.
- d
- the root VisualElement
GetRelativeElementPoint(FrameworkElement, Spot) : Point
Compute the point of a in a FrameworkElement that is within the visual tree of this part, relative to the top-left corner of this part.
- elt
- a FrameworkElement within this part
- spot
- a Spot; if the spot IsNoSpot assume Center instead.
Returns: a Point in model coordinates, taking any transforms into account, assuming the bounds are at (0,0)
GetReshapable(DependencyObject) : bool
Gets the value of the Reshapable attached dependency property.
- d
- the root VisualElement
GetResizable(DependencyObject) : bool
Gets the value of the Resizable attached dependency property.
- d
- the root VisualElement
GetResizeAdornmentTemplate(DependencyObject) : DataTemplate
Gets the value of the ResizeAdornmentTemplate attached dependency property.
- d
- the root VisualElement
GetResizeCellSize(DependencyObject) : Size
Gets the value of the ResizeCellSize attached dependency property.
- d
GetResizeElementName(DependencyObject) : string
Gets the value of the ResizeElementName attached dependency property.
- d
- the root VisualElement
GetRotatable(DependencyObject) : bool
Gets the value of the Rotatable attached dependency property.
- d
- the root VisualElement
GetRotateAdornmentTemplate(DependencyObject) : DataTemplate
Gets the value of the RotateAdornmentTemplate attached dependency property.
- d
- the root VisualElement
GetSelectable(DependencyObject) : bool
Gets the value of the Selectable attached dependency property.
- d
- the root VisualElement
GetSelectionAdorned(DependencyObject) : bool
Gets the value of the SelectionAdorned attached dependency property.
- d
- the root VisualElement
GetSelectionAdornmentTemplate(DependencyObject) : DataTemplate
Gets the value of the SelectionAdornmentTemplate attached dependency property.
- d
- the root VisualElement
GetSelectionElementName(DependencyObject) : string
Gets the value of the SelectionElementName attached dependency property.
- d
- the root VisualElement
GetText(DependencyObject) : string
Gets the value of the Text attached dependency property.
- d
- the root VisualElement
GetTextAspectRatio(DependencyObject) : double
Gets the value of the TextAspectRatioProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
Returns: By default this returns 1.5
GetTextEditable(DependencyObject) : bool
Gets the value of the TextEditableProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
Returns: By default this returns false
GetTextEditAdornmentTemplate(DependencyObject) : DataTemplate
Gets the value of the TextEditAdornmentTemplateProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
Returns: A DataTemplate, by default null. A null value causes the TextEditingTool to use a default template that uses a TextBox.
GetTextEditor(DependencyObject) : ITextEditor
Gets the value of the TextEditorProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
Returns: An ITextEditor. By default this returns null, which causes the TextEditingTool to use an editor that works with the default DependencyObject) that uses a TextBox.
GetVisible(DependencyObject) : bool
Gets the value of the Visible attached dependency property.
- d
- the root VisualElement
InvalidateRelationships()
Declare that this part and any links connected to this node or any groups related to this part are now invalid and should be re-computed, re-measured, and re-arranged.
IsVisibleElement(UIElement) : bool
This static predicate is true if the given 's Visibility is Visible and each of its visual parents are also visible elements, up to the containing Part.
- elt
MakeAdornment(FrameworkElement, DataTemplate) : Adornment
Create an Adornment for a particular FrameworkElement using a given DataTemplate.
- selelt
- must not be null
- templ
- must not be null
OnApplyTemplate()
Initialize Visibility according to the value of Visible.
OnIsDropOntoAcceptedChanged()
This virtual method is called whenever the value of IsDropOntoAccepted has changed.
OnIsSelectedChanged()
This virtual method is called whenever this part is added or removed from the collection of SelectedParts.
OnVisualParentChanged(DependencyObject)
Every Part's visual parent must be a Layer, if it has any parent.
- oldParent
Remeasure()
Re-measure and re-arrange this part in the near future.
RemeasureNow()
Re-measure and re-arrange this part right now, even if it's not ready.
SetAdornment(string, Adornment)
Associate an Adornment with this part.
- category
- this must be a non-null string
- ad
SetAngle(UIElement, double)
This calls Spot) to rotate the given element about its RotationSpot, or about the center of the element if this is not a Node.
- elt
- any UIElement within the visual tree of this Part
- angle
- a double between 0 and 360 degrees
SetAngle(UIElement, double, Spot)
Set the angle of an element in the visual tree of this part by creating or modifying a transform on that element.
- elt
- the UIElement to be rotated, an element in the visual tree of this Part
- angle
- a double between 0 and 360 degrees
- focus
- the spot of the rotation point; normally Spot.Center; any offset is ignored
SetCopyable(DependencyObject, bool)
Sets the value of the Copyable attached dependency property.
- d
- the root VisualElement
- v
SetDeletable(DependencyObject, bool)
Sets the value of the Deletable attached dependency property.
- d
- the root VisualElement
- v
SetDragOverSnapCellSize(DependencyObject, Size)
Sets the value of the DragOverSnapCellSize attached dependency property.
- d
- v
SetDragOverSnapCellSpot(DependencyObject, Spot)
Sets the value of the DragOverSnapCellSpot attached dependency property.
- d
- v
SetDragOverSnapEnabled(DependencyObject, bool)
Sets the value of the DragOverSnapEnabled attached dependency property.
- d
- v
SetDragOverSnapOrigin(DependencyObject, Point)
Sets the value of the DragOverSnapOrigin attached dependency property.
- d
- v
SetDropOntoBehavior(DependencyObject, DropOntoBehavior)
Sets the value of the DropOntoBehavior attached dependency property.
- d
- v
SetEditable(DependencyObject, bool)
Sets the value of the Editable attached dependency property.
- d
- the root VisualElement
- v
SetGroupable(DependencyObject, bool)
Sets the value of the Groupable attached dependency property.
- d
- the root VisualElement
- v
SetInDiagramBounds(DependencyObject, bool)
Sets the value of the InDiagramBounds attached dependency property.
- d
- the root VisualElement
- v
SetLayerName(DependencyObject, string)
Sets the value of the LayerName attached dependency property.
- d
- the root VisualElement
- v
SetLayoutId(DependencyObject, string)
Sets the value of the LayoutId attached dependency property.
- d
- the root VisualElement
- v
SetMovable(DependencyObject, bool)
Sets the value of the Movable attached dependency property.
- d
- the root VisualElement
- v
SetPrintable(DependencyObject, bool)
Sets the value of the Printable attached dependency property.
- d
- the root VisualElement
- v
SetReshapable(DependencyObject, bool)
Sets the value of the Reshapable attached dependency property.
- d
- the root VisualElement
- v
SetResizable(DependencyObject, bool)
Sets the value of the Resizable attached dependency property.
- d
- the root VisualElement
- v
SetResizeAdornmentTemplate(DependencyObject, DataTemplate)
Sets the value of the ResizeAdornmentTemplate attached dependency property.
- d
- the root VisualElement
- v
SetResizeCellSize(DependencyObject, Size)
Sets the value of the ResizeCellSize attached dependency property.
- d
- v
SetResizeElementName(DependencyObject, string)
Sets the value of the ResizeElementName attached dependency property.
- d
- the root VisualElement
- v
SetRotatable(DependencyObject, bool)
Sets the value of the Rotatable attached dependency property.
- d
- the root VisualElement
- v
SetRotateAdornmentTemplate(DependencyObject, DataTemplate)
Sets the value of the RotateAdornmentTemplate attached dependency property.
- d
- the root VisualElement
- v
SetSelectable(DependencyObject, bool)
Sets the value of the Selectable attached dependency property.
- d
- the root VisualElement
- v
SetSelectionAdorned(DependencyObject, bool)
Sets the value of the SelectionAdorned attached dependency property.
- d
- the root VisualElement
- v
SetSelectionAdornmentTemplate(DependencyObject, DataTemplate)
Sets the value of the SelectionAdornmentTemplate attached dependency property.
- d
- the root VisualElement
- v
SetSelectionElementName(DependencyObject, string)
Sets the value of the SelectionElementName attached dependency property.
- d
- the root VisualElement
- v
SetText(DependencyObject, string)
Sets the value of the Text attached dependency property.
- d
- the root VisualElement
- v
SetTextAspectRatio(DependencyObject, double)
Sets the value of the TextAspectRatioProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
- v
- a positive value that is the desired ratio of width to height
SetTextEditable(DependencyObject, bool)
Sets the value of the TextEditableProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
- v
SetTextEditAdornmentTemplate(DependencyObject, DataTemplate)
Sets the value of the TextEditAdornmentTemplateProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
- v
SetTextEditor(DependencyObject, ITextEditor)
Sets the value of the TextEditorProperty attached dependency property.
- d
- any TextBlock within the visual tree of the part
- v
- an ITextEditor
SetVisible(DependencyObject, bool)
Sets the value of the Visible attached dependency property.
- d
- the root VisualElement
- v
UpdateAdornments()
Maybe create adornments if needed, or remove them if not.
UpdateSelectionAdornment()
This is responsible for creating a selection adornment for this part if this part IsSelected and if SelectionAdorned is true.
UpdateToolAdornments()
This is responsible for creating any tool adornments for this part.
Fields
BoundsProperty : DependencyProperty
Identifies the read-only Bounds dependency property.
CategoryProperty : DependencyProperty
Identifies the Category dependency property.
CopyableProperty : DependencyProperty
Identifies the Copyable attached dependency property that must only be on the root VisualElement.
DeletableProperty : DependencyProperty
Identifies the Deletable attached dependency property that must only be on the root VisualElement.
DragOverSnapCellSizeProperty : DependencyProperty
Identifies the DragOverSnapCellSize attached dependency property that must only be on the root VisualElement.
DragOverSnapCellSpotProperty : DependencyProperty
Identifies the DragOverSnapCellSpot attached dependency property that must only be on the root VisualElement.
DragOverSnapEnabledProperty : DependencyProperty
Identifies the DragOverSnapEnabled attached dependency property that must only be on the root VisualElement.
DragOverSnapOriginProperty : DependencyProperty
Identifies the DragOverSnapOrigin attached dependency property that must only be on the root VisualElement.
DropOntoBehaviorProperty : DependencyProperty
Identifies the DropOntoBehavior attached dependency property that must only be on the root VisualElement.
EditableProperty : DependencyProperty
Identifies the Editable attached dependency property that must only be on the root VisualElement.
GroupableProperty : DependencyProperty
Identifies the Groupable attached dependency property that must only be on the root VisualElement.
InDiagramBoundsProperty : DependencyProperty
Identifies the InDiagramBounds attached dependency property that must only be on the root VisualElement.
IsDropOntoAcceptedProperty : DependencyProperty
Identifies the IsDropOntoAccepted dependency property.
IsSelectedProperty : DependencyProperty
Identifies the IsSelected dependency property.
LayerNameProperty : DependencyProperty
Identifies the LayerName attached dependency property that must only be on the root VisualElement.
LayoutIdProperty : DependencyProperty
Identifies the LayoutId attached dependency property that must only be on the root VisualElement.
MovableProperty : DependencyProperty
Identifies the Movable attached dependency property that must only be on the root VisualElement.
PrintableProperty : DependencyProperty
Identifies the Printable attached dependency property that must only be on the root VisualElement.
ReshapableProperty : DependencyProperty
Identifies the Reshapable attached dependency property that must only be on the root VisualElement.
ResizableProperty : DependencyProperty
Identifies the Resizable attached dependency property that must only be on the root VisualElement.
ResizeAdornmentTemplateProperty : DependencyProperty
Identifies the ResizeAdornmentTemplate attached dependency property that must only be on the root VisualElement.
ResizeCellSizeProperty : DependencyProperty
Identifies the ResizeCellSize attached dependency property that must only be on the root VisualElement.
ResizeElementNameProperty : DependencyProperty
Identifies the ResizeElementName attached dependency property that must only be on the root VisualElement.
RotatableProperty : DependencyProperty
Identifies the Rotatable attached dependency property that must only be on the root VisualElement.
RotateAdornmentTemplateProperty : DependencyProperty
Identifies the RotateAdornmentTemplate attached dependency property that must only be on the root VisualElement.
SelectableProperty : DependencyProperty
Identifies the Selectable attached dependency property that must only be on the root VisualElement.
SelectionAdornedProperty : DependencyProperty
Identifies the SelectionAdorned attached dependency property that must only be on the root VisualElement.
SelectionAdornmentTemplateProperty : DependencyProperty
Identifies the SelectionAdornmentTemplate attached dependency property that must only be on the root VisualElement.
SelectionElementNameProperty : DependencyProperty
Identifies the SelectionElementName attached dependency property that must only be on the root VisualElement.
TextAspectRatioProperty : DependencyProperty
Identifies the TextAspectRatio attached dependency property that may be on any TextBlock.
TextEditableProperty : DependencyProperty
Identifies the TextEditable attached dependency property that may be on any TextBlock.
TextEditAdornmentTemplateProperty : DependencyProperty
Identifies the TextEditAdornmentTemplate attached dependency property that may be on any TextBlock.
TextEditorProperty : DependencyProperty
Identifies the TextEditor attached dependency property that may be on any TextBlock.
TextProperty : DependencyProperty
Identifies the Text attached dependency property that must only be on the root VisualElement.
VisibleProperty : DependencyProperty
Identifies the Visible attached dependency property that must only be on the root VisualElement.