|
|
@ -180,13 +180,13 @@ namespace Avalonia.Controls.UnitTests |
|
|
{ |
|
|
{ |
|
|
var items = new ObservableCollection<string>(); |
|
|
var items = new ObservableCollection<string>(); |
|
|
|
|
|
|
|
|
Action create = () => |
|
|
void create() |
|
|
{ |
|
|
{ |
|
|
foreach (var i in Enumerable.Range(1, 7)) |
|
|
foreach (var i in Enumerable.Range(1, 7)) |
|
|
{ |
|
|
{ |
|
|
items.Add(i.ToString()); |
|
|
items.Add(i.ToString()); |
|
|
} |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
create(); |
|
|
create(); |
|
|
|
|
|
|
|
|
@ -220,21 +220,20 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
|
|
|
|
|
var panel = target.Presenter.Panel; |
|
|
var panel = target.Presenter.Panel; |
|
|
|
|
|
|
|
|
Func<string> itemsToString = () => |
|
|
string itemsToString() => |
|
|
string.Join(",", panel.Children.OfType<ListBoxItem>().Select(l => l.Content.ToString()).ToArray()); |
|
|
string.Join(",", panel.Children.OfType<ListBoxItem>().Select(l => l.Content.ToString()).ToArray()); |
|
|
|
|
|
|
|
|
Action<string, string> addafter = (item, newitem) => |
|
|
void addafter(string item, string newitem) |
|
|
{ |
|
|
{ |
|
|
items.Insert(items.IndexOf(item) + 1, newitem); |
|
|
items.Insert(items.IndexOf(item) + 1, newitem); |
|
|
|
|
|
lm.ExecuteLayoutPass(); |
|
|
lm.ExecuteLayoutPass(); |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Action<string> remove = item => |
|
|
void remove(string item) |
|
|
{ |
|
|
{ |
|
|
items.Remove(item); |
|
|
items.Remove(item); |
|
|
lm.ExecuteLayoutPass(); |
|
|
lm.ExecuteLayoutPass(); |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
addafter("1", "1+");//expected 1,1+,2,3,4,5,6,7
|
|
|
addafter("1", "1+");//expected 1,1+,2,3,4,5,6,7
|
|
|
|
|
|
|
|
|
@ -276,7 +275,7 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
|
|
|
|
|
private FuncControlTemplate ListBoxTemplate() |
|
|
private FuncControlTemplate ListBoxTemplate() |
|
|
{ |
|
|
{ |
|
|
return new FuncControlTemplate<ListBox>(parent => |
|
|
return new FuncControlTemplate<ListBox>(parent => |
|
|
new ScrollViewer |
|
|
new ScrollViewer |
|
|
{ |
|
|
{ |
|
|
Name = "PART_ScrollViewer", |
|
|
Name = "PART_ScrollViewer", |
|
|
@ -293,7 +292,7 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
|
|
|
|
|
private FuncControlTemplate ListBoxItemTemplate() |
|
|
private FuncControlTemplate ListBoxItemTemplate() |
|
|
{ |
|
|
{ |
|
|
return new FuncControlTemplate<ListBoxItem>(parent => |
|
|
return new FuncControlTemplate<ListBoxItem>(parent => |
|
|
new ContentPresenter |
|
|
new ContentPresenter |
|
|
{ |
|
|
{ |
|
|
Name = "PART_ContentPresenter", |
|
|
Name = "PART_ContentPresenter", |
|
|
|