Werbung

Herkunft

Kurzinformation

Finds a Resource in a visual control or the controls parents

Syntax

<# .Synopsis Finds a Resource in a visual control or the controls parents .Description Retrieves a resource stored in the Resources property of a UIElement. If the UIElement does not contain the resource, the parent will be checked. If no more parents exist, then nothing will be returned. .Parameter Visual The UI element to start looking for resources. .Parameter Name The name of the resource to find .Example New-Grid -Rows '1*', 'Auto' { New-ListBox -On_Loaded { Set-Resource "List" $this -1 } New-Button -Row 1 "_Add" -On_Click { $list = Get-Resource "List" $list.ItemsSource += @(Get-Random) } } -Show #> param( [String] $Name, $Visual ) process { $item = $Visual if (-not $item) { $item = $this } while ($item) { foreach ($k in $item.Resources.Keys) { if ($k -ceq $Name) { return $item.Resources.$k } } $item = $item.Parent } }

Beschreibung

Retrieves a resource stored in the Resources property of a UIElement.If the UIElement does not contain the resource, the parent will be checked.If no more parents exist, then nothing will be returned.

Links

Liste aller Commandlets Mehr über die Windows PowerShell

Bücher zur PowerShell

Buchcover Windows PowerShell 5.0 - Das Praxishandbuch (1. Auflage 2016/5. Auflage Gesamtreihe) Windows PowerShell 5.0 - Das Praxishandbuch (1. Auflage 2016/5. Auflage Gesamtreihe)
Autoren: Dr. Holger Schwichtenberg
erschienen 2016, 996 Seiten, 49,99 €
ISBN: 3446446435
Bestellung: Amazon.de oder im Buchhandel über ISBN 3446446435

Schulungen/Seminare

Offene Seminare zur PowerShell
In-House-Seminare zur PowerShell