From c725f227a84d6ead7941a5af8c18de5201be7d9b Mon Sep 17 00:00:00 2001 From: Arufonsu <17498701+Arufonsu@users.noreply.github.com> Date: Sat, 10 Jan 2026 18:09:04 -0300 Subject: [PATCH] fix: combobox/menu items width fixes #2553 Signed-off-by: Arufonsu <17498701+Arufonsu@users.noreply.github.com> --- .../Gwen/Control/ComboBox.cs | 4 +--- .../Gwen/Control/ContextMenu.cs | 22 +------------------ .../Gwen/Control/Menu.cs | 6 +++++ 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Intersect.Client.Framework/Gwen/Control/ComboBox.cs b/Intersect.Client.Framework/Gwen/Control/ComboBox.cs index b7b1db5f6e..214878deaa 100644 --- a/Intersect.Client.Framework/Gwen/Control/ComboBox.cs +++ b/Intersect.Client.Framework/Gwen/Control/ComboBox.cs @@ -422,10 +422,8 @@ private static void Open(ComboBox @this) var menuItems = @this._menu.Children.OfType().ToArray(); foreach (var menuItem in menuItems) { - menuItem.SizeToContents(); + menuItem.AutoSizeToContents = false; totalChildHeight += menuItem.OuterHeight; - // TODO(2553): I thought this was the solution, it isn't. Results in menu growing each time it's opened. - // width = Math.Max(width, menuItem.OuterWidth + menuPaddingH); } var offset = @this.ToCanvas(default); diff --git a/Intersect.Client.Framework/Gwen/Control/ContextMenu.cs b/Intersect.Client.Framework/Gwen/Control/ContextMenu.cs index 7a04e6188e..552f5c616e 100644 --- a/Intersect.Client.Framework/Gwen/Control/ContextMenu.cs +++ b/Intersect.Client.Framework/Gwen/Control/ContextMenu.cs @@ -1,23 +1,3 @@ namespace Intersect.Client.Framework.Gwen.Control; -public class ContextMenu : Menu -{ - public ContextMenu(Base parent, string? name = default) : base(parent, name) - { - - } - - protected override void OnPositioningBeforeOpen() - { - base.OnPositioningBeforeOpen(); - - SizeToChildren(recursive: true); - } - - protected override void OnOpen() - { - base.OnOpen(); - - PostLayout.Enqueue(contextMenu => contextMenu.SizeToChildren(recursive: true), this); - } -} \ No newline at end of file +public class ContextMenu(Base parent, string? name = default) : Menu(parent, name); \ No newline at end of file diff --git a/Intersect.Client.Framework/Gwen/Control/Menu.cs b/Intersect.Client.Framework/Gwen/Control/Menu.cs index 861795a131..4ca64fd030 100644 --- a/Intersect.Client.Framework/Gwen/Control/Menu.cs +++ b/Intersect.Client.Framework/Gwen/Control/Menu.cs @@ -193,7 +193,13 @@ private static void Open(Menu @this, Pos position) protected virtual void OnPositioningBeforeOpen() { + var menuItems = Children.OfType().ToArray(); + foreach (var menuItem in menuItems) + { + menuItem.AutoSizeToContents = false; + } + SizeToChildren(recursive: true); } protected virtual void OnOpen()