using System; using System.Text.RegularExpressions; using Avalonia.Controls; using Avalonia.Controls.Primitives; using FluentAvalonia.UI.Controls; using StabilityMatrix.Avalonia.ViewModels.Inference; using StabilityMatrix.Core.Extensions; #pragma warning disable CS0657 // Not a valid attribute location for this declaration namespace StabilityMatrix.Avalonia.Controls; public class StackEditableCard : TemplatedControl { /// protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); var listBox = e.NameScope.Find("PART_ListBox"); if (listBox != null) { listBox.ContainerIndexChanged += (sender, args) => { if (args.Container.DataContext is StackExpanderViewModel vm) { vm.OnContainerIndexChanged(args.NewIndex); } }; } var addButton = e.NameScope.Find