@@ -33,6 +33,18 @@ public class ItemContainer : ContentControl, INodifyCanvasItem
3333 private static readonly DependencyPropertyKey IsPreviewingLocationPropertyKey = DependencyProperty . RegisterReadOnly ( nameof ( IsPreviewingLocation ) , typeof ( bool ) , typeof ( ItemContainer ) , new FrameworkPropertyMetadata ( BoxValue . False ) ) ;
3434 public static readonly DependencyProperty IsPreviewingLocationProperty = IsPreviewingLocationPropertyKey . DependencyProperty ;
3535 public static readonly DependencyProperty IsDraggableProperty = DependencyProperty . Register ( nameof ( IsDraggable ) , typeof ( bool ) , typeof ( ItemContainer ) , new FrameworkPropertyMetadata ( BoxValue . True ) ) ;
36+ public static readonly DependencyProperty HasCustomContextMenuProperty = NodifyEditor . HasCustomContextMenuProperty . AddOwner ( typeof ( ItemContainer ) ) ;
37+
38+ private static void OnLocationChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
39+ {
40+ var item = ( ItemContainer ) d ;
41+ item . OnLocationChanged ( ) ;
42+
43+ if ( item . Editor . IsLoaded && ! item . Editor . IsBulkUpdatingItems )
44+ {
45+ item . Editor . ItemsHost . InvalidateArrange ( ) ;
46+ }
47+ }
3648
3749 /// <summary>
3850 /// Gets or sets the brush used when the <see cref="PendingConnection.IsOverElementProperty"/> attached property is true for this <see cref="ItemContainer"/>.
@@ -135,17 +147,21 @@ public bool IsDraggable
135147 set => SetValue ( IsDraggableProperty , value ) ;
136148 }
137149
138- private static void OnLocationChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
150+ /// <summary>
151+ /// Gets or sets a value indicating whether the container uses a custom context menu.
152+ /// </summary>
153+ /// <remarks>When set to true, the container handles the right-click event for specific operations.</remarks>
154+ public bool HasCustomContextMenu
139155 {
140- var item = ( ItemContainer ) d ;
141- item . OnLocationChanged ( ) ;
142-
143- if ( item . Editor . IsLoaded && ! item . Editor . IsBulkUpdatingItems )
144- {
145- item . Editor . ItemsHost . InvalidateArrange ( ) ;
146- }
156+ get => ( bool ) GetValue ( HasCustomContextMenuProperty ) ;
157+ set => SetValue ( HasCustomContextMenuProperty , value ) ;
147158 }
148159
160+ /// <summary>
161+ /// Gets a value indicating whether the container has a context menu.
162+ /// </summary>
163+ public bool HasContextMenu => ContextMenu != null || HasCustomContextMenu ;
164+
149165 #endregion
150166
151167 #region Routed Events
0 commit comments