14 KiB
ItemContainer Class
Namespace: Nodify
Assembly: Nodify
Inheritance: Object → DispatcherObject → DependencyObject → Visual → UIElement → FrameworkElement → Control → ContentControl → ItemContainer
Implements: INodifyCanvasItem, IKeyboardFocusTarget<ItemContainer>
References: Connector, ContainerState.Default, EditorCommands, GroupingNode, InputProcessor, ItemsMovedEventArgs, NodifyEditor, PendingConnection, PreviewLocationChanged, SelectionType
The container for all the items generated by the ItemsControl.ItemsSource of the NodifyEditor.
public class ItemContainer : ContentControl, INodifyCanvasItem, IKeyboardFocusTarget<ItemContainer>
Constructors
ItemContainer(NodifyEditor)
Constructs an instance of an ItemContainer in the specified NodifyEditor.
public ItemContainer(NodifyEditor editor);
Parameters
editor NodifyEditor
Fields
IsPreviewingSelectionPropertyKey
protected static DependencyPropertyKey IsPreviewingSelectionPropertyKey;
Field Value
Properties
ActualSize
Gets the actual size of this ItemContainer.
public Size ActualSize { get; set; }
Property Value
Bounds
Gets the bounds of the selection area for this ItemContainer based on its ItemContainer.Location and ItemContainer.DesiredSizeForSelection.
public virtual Rect Bounds { get; set; }
Property Value
DesiredSizeForSelection
Overrides the size to check against when calculating if this ItemContainer can be part of the current NodifyEditor.SelectedArea. Defaults to UIElement.RenderSize.
public Size? DesiredSizeForSelection { get; set; }
Property Value
Editor
The NodifyEditor that owns this ItemContainer.
public NodifyEditor Editor { get; set; }
Property Value
HasContextMenu
Gets a value indicating whether the container has a context menu.
public bool HasContextMenu { get; set; }
Property Value
HasCustomContextMenu
Gets or sets a value indicating whether the container uses a custom context menu.
public bool HasCustomContextMenu { get; set; }
Property Value
HighlightBrush
Gets or sets the brush used when the PendingConnection.IsOverElementProperty attached property is true for this ItemContainer.
public Brush HighlightBrush { get; set; }
Property Value
InputProcessor
protected InputProcessor InputProcessor { get; set; }
Property Value
IsDraggable
Gets or sets whether this ItemContainer can be dragged.
public bool IsDraggable { get; set; }
Property Value
IsPreviewingLocation
Gets a value indicating whether this ItemContainer is previewing a new location but didn't logically move there.
public bool IsPreviewingLocation { get; set; }
Property Value
IsPreviewingSelection
Gets a value indicating whether this ItemContainer is about to change its ItemContainer.IsSelected state.
public Boolean? IsPreviewingSelection { get; set; }
Property Value
IsSelectable
Gets or sets whether this ItemContainer can be selected.
public bool IsSelectable { get; set; }
Property Value
IsSelected
Gets or sets a value that indicates whether this ItemContainer is selected. Can only be set if ItemContainer.IsSelectable is true.
public bool IsSelected { get; set; }
Property Value
Location
Gets or sets the location of this ItemContainer inside the NodifyEditor in graph space coordinates.
public virtual Point Location { get; set; }
Property Value
PreserveSelectionOnRightClick
Indicates whether right-click on the container should preserve the current selection.
public static bool PreserveSelectionOnRightClick { get; set; }
Property Value
SelectedBorderThickness
Gets or sets the border thickness used when ItemContainer.IsSelected or ItemContainer.IsPreviewingSelection is true.
public Thickness SelectedBorderThickness { get; set; }
Property Value
SelectedBrush
Gets or sets the brush used when ItemContainer.IsSelected or ItemContainer.IsPreviewingSelection is true.
public Brush SelectedBrush { get; set; }
Property Value
SelectedMargin
The calculated margin when the container is selected or previewing selection.
public Thickness SelectedMargin { get; set; }
Property Value
Methods
BeginDragging()
public void BeginDragging();
CancelDragging()
public void CancelDragging();
EndDragging()
public void EndDragging();
IsSelectableInArea(Rect, Boolean)
Checks if area contains or intersects with this ItemContainer taking into consideration the ItemContainer.DesiredSizeForSelection.
public virtual bool IsSelectableInArea(Rect area, bool isContained);
Parameters
area Rect: The area to check if contains or intersects this ItemContainer.
isContained Boolean: If true will check if area contains this, otherwise will check if area intersects with this.
Returns
Boolean: True if area contains or intersects this ItemContainer.
OnKeyDown(KeyEventArgs)
protected override void OnKeyDown(KeyEventArgs e);
Parameters
OnKeyUp(KeyEventArgs)
protected override void OnKeyUp(KeyEventArgs e);
Parameters
OnLocationChanged()
Raises the ItemContainer.LocationChangedEvent and sets ItemContainer.IsPreviewingLocation to false.
protected void OnLocationChanged();
OnLostMouseCapture(MouseEventArgs)
protected override void OnLostMouseCapture(MouseEventArgs e);
Parameters
OnMouseDown(MouseButtonEventArgs)
protected override void OnMouseDown(MouseButtonEventArgs e);
Parameters
OnMouseMove(MouseEventArgs)
protected override void OnMouseMove(MouseEventArgs e);
Parameters
OnMouseUp(MouseButtonEventArgs)
protected override void OnMouseUp(MouseButtonEventArgs e);
Parameters
OnMouseWheel(MouseWheelEventArgs)
protected override void OnMouseWheel(MouseWheelEventArgs e);
Parameters
OnRenderSizeChanged(SizeChangedInfo)
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo);
Parameters
sizeInfo SizeChangedInfo
OnSelectedChanged(Boolean)
Raises the ItemContainer.SelectedEvent or ItemContainer.UnselectedEvent based on newValue. Called when the ItemContainer.IsSelected value is changed.
protected void OnSelectedChanged(bool newValue);
Parameters
newValue Boolean: True if selected, false otherwise.
OnVisualParentChanged(DependencyObject)
protected override void OnVisualParentChanged(DependencyObject oldParent);
Parameters
oldParent DependencyObject
Select(SelectionType)
Modifies the selection state of the current item based on the specified selection type.
public void Select(SelectionType type);
Parameters
type SelectionType: The type of selection to perform.
UpdateDragging(Vector)
public void UpdateDragging(Vector amount);
Parameters
amount Vector
Events
LocationChanged
Occurs when the ItemContainer.Location of this ItemContainer is changed.
public event RoutedEventHandler LocationChanged;
Event Type
PreviewLocationChanged
Occurs when the ItemContainer is previewing a new location.
public event PreviewLocationChanged PreviewLocationChanged;
Event Type
Selected
Occurs when this ItemContainer is selected.
public event RoutedEventHandler Selected;
Event Type
Unselected
Occurs when this ItemContainer is unselected.
public event RoutedEventHandler Unselected;
Event Type