mirror of
https://github.com/Micke-K/IntuneManagement.git
synced 2026-09-28 19:05:38 +02:00
IntuneManagement 4.0.0-beta1
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Null-free array for anything assigned to a WPF ItemsSource.
|
||||
#
|
||||
# A $null element in an ItemsControl kills the host: WPF's layout and automation
|
||||
# passes index the items, and both throw ArgumentNullException on a null one, on
|
||||
# every render, until the process dies. @($null) is a ONE-element array containing
|
||||
# null, so an omitted parameter or an empty result lands there via the usual @($x).
|
||||
# Full write-up and the regression proof: Tests/UIItemsArray.Tests.ps1.
|
||||
#
|
||||
# The leading comma is load-bearing. A bare `return @(...)` is unrolled by the
|
||||
# pipeline, so zero items would come back as $null and ONE item as the bare
|
||||
# object - which cannot be assigned to an ItemsSource at all.
|
||||
function Get-UIItemsArray
|
||||
{
|
||||
param($Items)
|
||||
|
||||
return ,@(@($Items) | Where-Object { $null -ne $_ })
|
||||
}
|
||||
Reference in New Issue
Block a user