Fix runtime crash when adding controls (anything other than MultiComboBoxItem with text content) to a MultiComboBox in axaml

This commit is contained in:
Samuel Bergeron-Drouin
2025-08-25 10:30:56 -04:00
parent 65e94478b8
commit ca3e78c3a7
5 changed files with 51 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
namespace Ursa.Controls;
@@ -31,6 +33,15 @@ public class MultiComboBoxSelectedItemList: ItemsControl
if (container is ClosableTag tag)
{
tag.Command = RemoveCommand;
if (item is Layoutable visualContent)
{
tag.VisualContent = new VisualBrush
{
Visual = visualContent,
};
tag.VisualContentWidth = visualContent.Bounds.Width;
tag.VisualContentHeight = visualContent.Bounds.Height;
}
}
}
}