Same CustomMenuItem for both docked and float state
I have a docking manager with custom menu items with the following declaration:
<syncfusion:DockingManager.>
<syncfusion:CustomMenuItemCollection>
<!--Adding custom context menu items-->
<syncfusion:CustomMenuItem Header="DockMenu 1"/>
<syncfusion:CustomMenuItem Header="DockMenu 2">
<!--Adding sub custom context menu items-->
<syncfusion:CustomMenuItem Header="DockSubMenu 1"/>
<syncfusion:CustomMenuItem Header="DockSubMenu 2"/>
<syncfusion:CustomMenuItem Header="DockSubMenu 3" IsChecked="True"/>
</syncfusion:CustomMenuItem>
</syncfusion:CustomMenuItemCollection>
</syncfusion:DockingManager.CustomMenu>
The problem is, when a window is floating, I get the following exception when I right click the header of the float window: 'Element already has a logical parent. It must be detached from the old parent before it is attached to a new one'.
I've seen the sample where the declaration for custom menu items are split for both the docked window and float window using DockWindowContextMenuItems and FloatWindowContextMenuItems, however I would like to avoid using these because I don't want duplicate code for the same exact menu item.
How can I achieve this functionality with only one custom menu item declaration for both the float and docked window?
Hi Josepth Badrouk,
We have confirmed the reported scenario is a defect and logged a report for the reported scenario, “Exception when reusing CustomMenuItemCollection for both docked and floating windows in DockingManager”. We will fix this issue and include it in our NuGet release which is scheduled for 27th May 2025.
You can track the status of this defect using the following feedback link: Exception when reusing CustomMenuItemCollection for both docked and floating windows in DockingManager in WPF | Feedback Portal
Please let us know
if you need any further assistance.
Note: The provided feedback link is private, and you need to log in to view this feedback.
Disclaimer:
“Inclusion of this solution in the weekly release may change due to other
factors including but not limited to QA checks and works reprioritization.”
Regards,
Sekar Sivalingam
Hi Josepth Badrouk,
We have included the fix for the reported issue “Exception when reusing CustomMenuItemCollection for both docked and floating windows in DockingManager” in our Weekly NuGet release version 29.2.8 which is available for download ( https://www.nuget.org/).
Root Cause: The same MenuItem instances are being added to multiple context menus, violating WPF’s rule that a UI element can only have one logical parent.
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance
Regards,
Sekar Sivalingam
- 2 Replies
- 2 Participants
-
JB Josepth Badrouk
- May 6, 2025 07:21 PM UTC
- Jun 3, 2025 06:35 AM UTC