Skip to content

Nodify_ItemContainer

miroiu edited this page Dec 23, 2024 · 1 revision

ItemContainer Class

Namespace: Nodify

Assembly: Nodify

Inheritance: ObjectDispatcherObjectDependencyObjectVisualUIElementFrameworkElementControlContentControlItemContainer

Implements: INodifyCanvasItem

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  

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

DependencyPropertyKey

Properties

ActualSize

Gets the actual size of this ItemContainer.

public Size ActualSize { get; set; }  

Property Value

Size

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

Size?

Editor

The NodifyEditor that owns this ItemContainer.

public NodifyEditor Editor { get; set; }  

Property Value

NodifyEditor

HasContextMenu

Gets a value indicating whether the container has a context menu.

public bool HasContextMenu { get; set; }  

Property Value

Boolean

HasCustomContextMenu

Gets or sets a value indicating whether the container uses a custom context menu.

public bool HasCustomContextMenu { get; set; }  

Property Value

Boolean

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

Brush

InputProcessor

protected InputProcessor InputProcessor { get; set; }  

Property Value

InputProcessor

IsDraggable

Gets or sets whether this ItemContainer can be dragged.

public bool IsDraggable { get; set; }  

Property Value

Boolean

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

Boolean

IsPreviewingSelection

Gets a value indicating whether this ItemContainer is about to change its ItemContainer.IsSelected state.

public Boolean? IsPreviewingSelection { get; set; }  

Property Value

Boolean?

IsSelectable

Gets or sets whether this ItemContainer can be selected.

public bool IsSelectable { get; set; }  

Property Value

Boolean

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

Boolean

Location

Gets or sets the location of this ItemContainer inside the NodifyEditor in graph space coordinates.

public virtual Point Location { get; set; }  

Property Value

Point

PreserveSelectionOnRightClick

Indicates whether right-click on the container should preserve the current selection.

public static bool PreserveSelectionOnRightClick { get; set; }  

Property Value

Boolean

SelectedBorderThickness

Gets or sets the border thickness used when ItemContainer.IsSelected or ItemContainer.IsPreviewingSelection is true.

public Thickness SelectedBorderThickness { get; set; }  

Property Value

Thickness

SelectedBrush

Gets or sets the brush used when ItemContainer.IsSelected or ItemContainer.IsPreviewingSelection is true.

public Brush SelectedBrush { get; set; }  

Property Value

Brush

SelectedMargin

The calculated margin when the container is selected or previewing selection.

public Thickness SelectedMargin { get; set; }  

Property Value

Thickness

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

e KeyEventArgs

OnKeyUp(KeyEventArgs)

protected override void OnKeyUp(KeyEventArgs e);  

Parameters

e KeyEventArgs

OnLocationChanged()

Raises the ItemContainer.LocationChangedEvent and sets ItemContainer.IsPreviewingLocation to false.

protected void OnLocationChanged();  

OnLostMouseCapture(MouseEventArgs)

protected override void OnLostMouseCapture(MouseEventArgs e);  

Parameters

e MouseEventArgs

OnMouseDown(MouseButtonEventArgs)

protected override void OnMouseDown(MouseButtonEventArgs e);  

Parameters

e MouseButtonEventArgs

OnMouseMove(MouseEventArgs)

protected override void OnMouseMove(MouseEventArgs e);  

Parameters

e MouseEventArgs

OnMouseUp(MouseButtonEventArgs)

protected override void OnMouseUp(MouseButtonEventArgs e);  

Parameters

e MouseButtonEventArgs

OnMouseWheel(MouseWheelEventArgs)

protected override void OnMouseWheel(MouseWheelEventArgs e);  

Parameters

e MouseWheelEventArgs

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.

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

RoutedEventHandler

PreviewLocationChanged

Occurs when the ItemContainer is previewing a new location.

public event PreviewLocationChanged PreviewLocationChanged;  

Event Type

PreviewLocationChanged

Selected

Occurs when this ItemContainer is selected.

public event RoutedEventHandler Selected;  

Event Type

RoutedEventHandler

Unselected

Occurs when this ItemContainer is unselected.

public event RoutedEventHandler Unselected;  

Event Type

RoutedEventHandler

Clone this wiki locally