Browse Source
Merge pull request #4740 from workgroupengineering/fixes/Issue_4732
Fixes issue 4732
repro/bound-listboxes
Steven Kirk
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
11 additions and
5 deletions
-
src/Avalonia.Controls/Generators/ItemContainerGenerator`1.cs
-
tests/Avalonia.Controls.UnitTests/Generators/ItemContainerGeneratorTests.cs
|
|
|
@ -47,11 +47,7 @@ namespace Avalonia.Controls.Generators |
|
|
|
{ |
|
|
|
var container = item as T; |
|
|
|
|
|
|
|
if (item == null) |
|
|
|
{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
else if (container != null) |
|
|
|
if (container != null) |
|
|
|
{ |
|
|
|
return container; |
|
|
|
} |
|
|
|
|
|
|
|
@ -144,6 +144,16 @@ namespace Avalonia.Controls.UnitTests.Generators |
|
|
|
Assert.Equal("bar", container.Content); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Materialize_Should_Create_Containers_When_Item_Is_Null() |
|
|
|
{ |
|
|
|
var owner = new Decorator(); |
|
|
|
var target = new ItemContainerGenerator<ListBoxItem>(owner, ListBoxItem.ContentProperty, null); |
|
|
|
var container = (ListBoxItem)target.Materialize(0, null).ContainerControl; |
|
|
|
|
|
|
|
Assert.True(container != null, "The containers is not materialized."); |
|
|
|
} |
|
|
|
|
|
|
|
private IList<ItemContainerInfo> Materialize( |
|
|
|
IItemContainerGenerator generator, |
|
|
|
int index, |
|
|
|
|