You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
839 B
29 lines
839 B
using System.Linq; |
|
using Avalonia.Controls; |
|
using Avalonia.Controls.Primitives; |
|
using Avalonia.Xaml.Interactions.Draggable; |
|
using Avalonia.Xaml.Interactivity; |
|
using StabilityMatrix.Avalonia.ViewModels.Inference; |
|
|
|
namespace StabilityMatrix.Avalonia.Controls; |
|
|
|
public class StackEditableCard : TemplatedControl |
|
{ |
|
/// <inheritdoc /> |
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) |
|
{ |
|
base.OnApplyTemplate(e); |
|
|
|
var listBox = e.NameScope.Find<ListBox>("PART_ListBox"); |
|
if (listBox != null) |
|
{ |
|
listBox.ContainerIndexChanged += (sender, args) => |
|
{ |
|
if (args.Container.DataContext is StackExpanderViewModel vm) |
|
{ |
|
vm.OnContainerIndexChanged(args.NewIndex); |
|
} |
|
}; |
|
} |
|
} |
|
}
|
|
|