Werbung

Herkunft

Kurzinformation

Sets the dependency properties on an object.

Syntax

<# .Synopsis Sets the dependency properties on an object. .Description Sets the dependency properties on an object. Dependency properties are used in WPF to attach auxilliary information to an object that other UI components may use. .Parameter Target The object to set dependency properties on. .Parameter Property The Dependency Properties to set. Properties must be qualified dependency properties (i.e. [Windows.Window]::ContentProperty) .Parameter Name Use this parameter instead of Property to provide a short name for the dependency properties (i.e. Content) .Parameter Value The value to set on the dependency properties #> [CmdletBinding(DefaultParameterSetName="Name")] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] [ValidateNotNullOrEmpty()] [Windows.DependencyObject[]] $Target, # The Dependency Property to Set [Parameter(ValueFromPipelineByPropertyName=$true, ParameterSetName="Property", Mandatory=$true)] [Windows.DependencyProperty[]] [ValidateNotNullOrEmpty()] $Property, # The name of the depencency property to set. The dependency property must exist on the current object. [Parameter(ValueFromPipelineByPropertyName=$true, ParameterSetName="Name", Mandatory=$true)] [ValidateNotNullOrEmpty()] [String[]] $Name, # The value or values to use. [Parameter(ValueFromPipelineByPropertyName=$true, ParameterSetName="Name", Mandatory=$true)] [Parameter(ValueFromPipelineByPropertyName=$true, ParameterSetName="Property", Mandatory=$true)] [ValidateNotNullOrEmpty()] [Array] $Value ) process { foreach ($t in $target) { switch ($psCmdlet.ParameterSetName) { Name { for ($i = 0; $i -lt $name.Count; $i++) { $dp = $t.GetType()::($name[$i] + "Property") if (-not $dp) { continue } $t.SetValue($dp, $value[$i] -as $dp.PropertyType) } } Property { for ($i = 0; $i -lt $property.Count; $i++) { $t.SetValue($property[$i], $value[$i] -as $property[$i].PropertyType) } } } } }

Beschreibung

Sets the dependency properties on an object.Dependency properties are used in WPF to attach auxilliary information to an object that other UI components may use.

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