|
@@ -1,6 +1,10 @@
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using Avalonia;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Controls;
|
|
|
|
+using Avalonia.Controls.Generators;
|
|
|
|
+using Avalonia.Controls.Templates;
|
|
|
|
+using Avalonia.Layout;
|
|
|
|
+using Avalonia.Markup.Xaml.Templates;
|
|
using PixiEditor.AvaloniaUI.Helpers.Extensions;
|
|
using PixiEditor.AvaloniaUI.Helpers.Extensions;
|
|
using PixiEditor.ChangeableDocument.Enums;
|
|
using PixiEditor.ChangeableDocument.Enums;
|
|
using PixiEditor.Extensions.UI;
|
|
using PixiEditor.Extensions.UI;
|
|
@@ -29,10 +33,16 @@ internal class BlendModeComboBox : ComboBox
|
|
|
|
|
|
public BlendModeComboBox()
|
|
public BlendModeComboBox()
|
|
{
|
|
{
|
|
|
|
+ ItemsPanel = new FuncTemplate<Panel>(() => new StackPanel() { Orientation = Orientation.Vertical });
|
|
AddItems();
|
|
AddItems();
|
|
SelectionChanged += OnSelectionChange;
|
|
SelectionChanged += OnSelectionChange;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected override Control CreateContainerForItemOverride(object? item, int index, object? recycleKey)
|
|
|
|
+ {
|
|
|
|
+ return item is Separator ? new Separator() : base.CreateContainerForItemOverride(item, index, recycleKey);
|
|
|
|
+ }
|
|
|
|
+
|
|
private void OnSelectionChange(object sender, SelectionChangedEventArgs e)
|
|
private void OnSelectionChange(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
if (ignoreSelectionChange || e.AddedItems.Count == 0 || e.AddedItems[0] is not ComboBoxItem item || item.Tag is not BlendMode mode)
|
|
if (ignoreSelectionChange || e.AddedItems.Count == 0 || e.AddedItems[0] is not ComboBoxItem item || item.Tag is not BlendMode mode)
|
|
@@ -94,6 +104,7 @@ internal class BlendModeComboBox : ComboBox
|
|
{
|
|
{
|
|
Translator.SetKey(boxItem, boxItem.Content.ToString());
|
|
Translator.SetKey(boxItem, boxItem.Content.ToString());
|
|
}
|
|
}
|
|
|
|
+
|
|
Items.Add(item);
|
|
Items.Add(item);
|
|
}
|
|
}
|
|
SelectedIndex = 0;
|
|
SelectedIndex = 0;
|