Browse Source
Merge pull request #1611 from AvaloniaUI/feature/single-item-psuedo-class-items-control
add singleitem psuedo class on items control.
pull/1567/head
danwalmsley
9 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
0 deletions
-
src/Avalonia.Controls/ItemsControl.cs
|
|
|
@ -364,6 +364,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
var collection = sender as ICollection; |
|
|
|
PseudoClasses.Set(":empty", collection == null || collection.Count == 0); |
|
|
|
PseudoClasses.Set(":singleitem", collection != null && collection.Count == 1); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -421,6 +422,7 @@ namespace Avalonia.Controls |
|
|
|
private void SubscribeToItems(IEnumerable items) |
|
|
|
{ |
|
|
|
PseudoClasses.Set(":empty", items == null || items.Count() == 0); |
|
|
|
PseudoClasses.Set(":singleitem", items != null && items.Count() == 1); |
|
|
|
|
|
|
|
var incc = items as INotifyCollectionChanged; |
|
|
|
|
|
|
|
|