-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path1017.ps1
More file actions
29 lines (26 loc) · 872 Bytes
/
1017.ps1
File metadata and controls
29 lines (26 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#function Set-AttachedProperty {
[CmdletBinding()]
PARAM(
[Parameter(Position=0,Mandatory=$true)
[System.Windows.DependencyProperty]
$Property
,
[Parameter(Mandatory=$true,ValueFromPipeline=$true)
$Element
)
DYNAMICPARAM {
$paramDictionary = new-object System.Management.Automation.RuntimeDefinedParameterDictionary
$Param1 = new-object System.Management.Automation.RuntimeDefinedParameter
$Param1.Name = "Value"
# $Param1.Attributes.Add( (New-ParameterAttribute -Position 1) )
$Param1.Attributes.Add( (New-Object System.Management.Automation.ParameterAttribute -Property @{ Position = 1 }) )
$Param1.ParameterType = $Property.PropertyType
$paramDictionary.Add("Value", $Param1)
return $paramDictionary
}
PROCESS {
$Element.SetValue($Property, $Param1.Value)
$Element
}
#}
#New-Alias sap Set-AttachedProperty