Created
January 30, 2014 08:20
-
-
Save Jaykul/8704538 to your computer and use it in GitHub Desktop.
Ribbon Window in PowerShell (#requires ShowUI)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## AutoGenerated file. Do Not Edit. Regenerate by running | |
| ## Add-UIModule -AssemblyName System.Windows.Controls.Ribbon -Name Ribbon | |
| @{ | |
| ModuleVersion = '1.0' | |
| RequiredModules = 'ShowUI' | |
| RequiredAssemblies = 'System.Xaml','System.Windows.Controls.Ribbon' | |
| ModuleToProcess = 'Ribbon.psm1' | |
| GUID = 'b307ebad-cfb1-4c34-895c-471792c513db' | |
| FunctionsToExport = @('New-KeyTipControl','New-RibbonContextualTabGroupsPanel','New-RibbonGalleryCategoriesPanel','New-RibbonGalleryItemsPanel','New-RibbonGroupItemsPanel','New-RibbonGroupsPanel','New-RibbonMenuItemsPanel','New-RibbonQuickAccessToolBarOverflowPanel','New-RibbonQuickAccessToolBarPanel','New-RibbonTabHeadersPanel','New-RibbonTabsPanel','New-RibbonTitlePanel','New-StarLayoutInfo','New-Ribbon','New-RibbonMenuButton','New-RibbonApplicationMenu','New-RibbonMenuItem','New-RibbonApplicationMenuItem','New-RibbonSplitMenuItem','New-RibbonApplicationSplitMenuItem','New-RibbonButton','New-RibbonCheckBox','New-RibbonComboBox','New-RibbonContextMenu','New-RibbonContextualTabGroup','New-RibbonContextualTabGroupItemsControl','New-RibbonControl','New-RibbonContentPresenter','New-RibbonControlGroup','New-RibbonControlSizeDefinition','New-RibbonFilterMenuButton','New-RibbonGallery','New-RibbonGalleryCategory','New-RibbonGalleryItem','New-RibbonGroup','New-RibbonGroupSizeDefinition','New-RibbonGroupTemplateSizeDefinition','New-RibbonQuickAccessToolBar','New-RibbonRadioButton','New-RibbonSeparator','New-RibbonSplitButton','New-RibbonTab','New-RibbonTabHeader','New-RibbonTabHeaderItemsControl','New-RibbonTextBox','New-RibbonToggleButton','New-RibbonToolTip','New-RibbonTwoLineText','New-RibbonWindow' ) | |
| AliasesToExport = @( 'KeyTipControl','RibbonContextualTabGroupsPanel','RibbonGalleryCategoriesPanel','RibbonGalleryItemsPanel','RibbonGroupItemsPanel','RibbonGroupsPanel','RibbonMenuItemsPanel','RibbonQuickAccessToolBarOverflowPanel','RibbonQuickAccessToolBarPanel','RibbonTabHeadersPanel','RibbonTabsPanel','RibbonTitlePanel','StarLayoutInfo','Ribbon','RibbonMenuButton','RibbonApplicationMenu','RibbonMenuItem','RibbonApplicationMenuItem','RibbonSplitMenuItem','RibbonApplicationSplitMenuItem','RibbonButton','RibbonCheckBox','RibbonComboBox','RibbonContextMenu','RibbonContextualTabGroup','RibbonContextualTabGroupItemsControl','RibbonControl','RibbonContentPresenter','RibbonControlGroup','RibbonControlSizeDefinition','RibbonFilterMenuButton','RibbonGallery','RibbonGalleryCategory','RibbonGalleryItem','RibbonGroup','RibbonGroupSizeDefinition','RibbonGroupTemplateSizeDefinition','RibbonQuickAccessToolBar','RibbonRadioButton','RibbonSeparator','RibbonSplitButton','RibbonTab','RibbonTabHeader','RibbonTabHeaderItemsControl','RibbonTextBox','RibbonToggleButton','RibbonToolTip','RibbonTwoLineText','RibbonWindow' ) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## AutoGenerated file. Do Not Edit. Regenerate by running | |
| ## Add-UIModule -AssemblyName System.Windows.Controls.Ribbon -Name Ribbon | |
| function New-KeyTipControl { | |
| <# | |
| .Example | |
| New-KeyTipControl | |
| .Example | |
| New-KeyTipControl -OutputXaml | |
| .Example | |
| New-KeyTipControl -Show | |
| .Example | |
| New-KeyTipControl -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.KeyTipControl | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.KeyTipControl | |
| #> | |
| param( | |
| ${Text}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.KeyTipControl | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonContextualTabGroupsPanel { | |
| <# | |
| .Example | |
| New-RibbonContextualTabGroupsPanel | |
| .Example | |
| New-RibbonContextualTabGroupsPanel -OutputXaml | |
| .Example | |
| New-RibbonContextualTabGroupsPanel -Show | |
| .Example | |
| New-RibbonContextualTabGroupsPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonContextualTabGroupsPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonContextualTabGroupsPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonContextualTabGroupsPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGalleryCategoriesPanel { | |
| <# | |
| .Example | |
| New-RibbonGalleryCategoriesPanel | |
| .Example | |
| New-RibbonGalleryCategoriesPanel -OutputXaml | |
| .Example | |
| New-RibbonGalleryCategoriesPanel -Show | |
| .Example | |
| New-RibbonGalleryCategoriesPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGalleryCategoriesPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGalleryCategoriesPanel | |
| #> | |
| param( | |
| ${Children}, | |
| [switch] | |
| ${CanHorizontallyScroll}, | |
| [switch] | |
| ${CanVerticallyScroll}, | |
| ${ScrollOwner}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonGalleryCategoriesPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGalleryItemsPanel { | |
| <# | |
| .Example | |
| New-RibbonGalleryItemsPanel | |
| .Example | |
| New-RibbonGalleryItemsPanel -OutputXaml | |
| .Example | |
| New-RibbonGalleryItemsPanel -Show | |
| .Example | |
| New-RibbonGalleryItemsPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGalleryItemsPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGalleryItemsPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonGalleryItemsPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGroupItemsPanel { | |
| <# | |
| .Example | |
| New-RibbonGroupItemsPanel | |
| .Example | |
| New-RibbonGroupItemsPanel -OutputXaml | |
| .Example | |
| New-RibbonGroupItemsPanel -Show | |
| .Example | |
| New-RibbonGroupItemsPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGroupItemsPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGroupItemsPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonGroupItemsPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGroupsPanel { | |
| <# | |
| .Example | |
| New-RibbonGroupsPanel | |
| .Example | |
| New-RibbonGroupsPanel -OutputXaml | |
| .Example | |
| New-RibbonGroupsPanel -Show | |
| .Example | |
| New-RibbonGroupsPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGroupsPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonGroupsPanel | |
| #> | |
| param( | |
| ${Children}, | |
| [switch] | |
| ${IsStarLayoutPass}, | |
| [System.Windows.Controls.Orientation] | |
| ${Orientation}, | |
| [switch] | |
| ${CanHorizontallyScroll}, | |
| [switch] | |
| ${CanVerticallyScroll}, | |
| ${ScrollOwner}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonGroupsPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonMenuItemsPanel { | |
| <# | |
| .Example | |
| New-RibbonMenuItemsPanel | |
| .Example | |
| New-RibbonMenuItemsPanel -OutputXaml | |
| .Example | |
| New-RibbonMenuItemsPanel -Show | |
| .Example | |
| New-RibbonMenuItemsPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonMenuItemsPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonMenuItemsPanel | |
| #> | |
| param( | |
| ${Children}, | |
| [System.Windows.Controls.Orientation] | |
| ${Orientation}, | |
| [switch] | |
| ${CanHorizontallyScroll}, | |
| [switch] | |
| ${CanVerticallyScroll}, | |
| ${ScrollOwner}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonMenuItemsPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonQuickAccessToolBarOverflowPanel { | |
| <# | |
| .Example | |
| New-RibbonQuickAccessToolBarOverflowPanel | |
| .Example | |
| New-RibbonQuickAccessToolBarOverflowPanel -OutputXaml | |
| .Example | |
| New-RibbonQuickAccessToolBarOverflowPanel -Show | |
| .Example | |
| New-RibbonQuickAccessToolBarOverflowPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonQuickAccessToolBarOverflowPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonQuickAccessToolBarOverflowPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonQuickAccessToolBarOverflowPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonQuickAccessToolBarPanel { | |
| <# | |
| .Example | |
| New-RibbonQuickAccessToolBarPanel | |
| .Example | |
| New-RibbonQuickAccessToolBarPanel -OutputXaml | |
| .Example | |
| New-RibbonQuickAccessToolBarPanel -Show | |
| .Example | |
| New-RibbonQuickAccessToolBarPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonQuickAccessToolBarPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonQuickAccessToolBarPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonQuickAccessToolBarPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTabHeadersPanel { | |
| <# | |
| .Example | |
| New-RibbonTabHeadersPanel | |
| .Example | |
| New-RibbonTabHeadersPanel -OutputXaml | |
| .Example | |
| New-RibbonTabHeadersPanel -Show | |
| .Example | |
| New-RibbonTabHeadersPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonTabHeadersPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonTabHeadersPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${ScrollOwner}, | |
| [switch] | |
| ${CanVerticallyScroll}, | |
| [switch] | |
| ${CanHorizontallyScroll}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonTabHeadersPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTabsPanel { | |
| <# | |
| .Example | |
| New-RibbonTabsPanel | |
| .Example | |
| New-RibbonTabsPanel -OutputXaml | |
| .Example | |
| New-RibbonTabsPanel -Show | |
| .Example | |
| New-RibbonTabsPanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonTabsPanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonTabsPanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${ScrollOwner}, | |
| [switch] | |
| ${CanVerticallyScroll}, | |
| [switch] | |
| ${CanHorizontallyScroll}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonTabsPanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTitlePanel { | |
| <# | |
| .Example | |
| New-RibbonTitlePanel | |
| .Example | |
| New-RibbonTitlePanel -OutputXaml | |
| .Example | |
| New-RibbonTitlePanel -Show | |
| .Example | |
| New-RibbonTitlePanel -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonTitlePanel | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.RibbonTitlePanel | |
| #> | |
| param( | |
| ${Children}, | |
| ${Background}, | |
| [switch] | |
| ${IsItemsHost}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.RibbonTitlePanel | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-StarLayoutInfo { | |
| <# | |
| .Example | |
| New-StarLayoutInfo | |
| .Example | |
| New-StarLayoutInfo -OutputXaml | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.StarLayoutInfo | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Primitives.StarLayoutInfo | |
| #> | |
| param( | |
| [double] | |
| ${RequestedStarWeight}, | |
| [double] | |
| ${RequestedStarMinWidth}, | |
| [double] | |
| ${RequestedStarMaxWidth}, | |
| [double] | |
| ${AllocatedStarWidth}, | |
| [switch] | |
| ${OutputXaml} | |
| ) | |
| begin { | |
| } | |
| process { | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Primitives.StarLayoutInfo | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-Ribbon { | |
| <# | |
| .Example | |
| New-Ribbon | |
| .Example | |
| New-Ribbon -OutputXaml | |
| .Example | |
| New-Ribbon -Show | |
| .Example | |
| New-Ribbon -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.Ribbon | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.Ribbon | |
| #> | |
| param( | |
| ${Items}, | |
| [System.Windows.Visibility] | |
| ${WindowIconVisibility}, | |
| [switch] | |
| ${IsHostedInRibbonWindow}, | |
| ${ApplicationMenu}, | |
| ${QuickAccessToolBar}, | |
| ${HelpPaneContent}, | |
| ${HelpPaneContentTemplate}, | |
| [switch] | |
| ${IsMinimized}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| [switch] | |
| ${IsCollapsed}, | |
| ${Title}, | |
| ${TitleTemplate}, | |
| [switch] | |
| ${ShowQuickAccessToolBarOnTop}, | |
| ${ContextualTabGroupsSource}, | |
| ${ContextualTabGroups}, | |
| ${ContextualTabGroupHeaderTemplate}, | |
| ${ContextualTabGroupStyle}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${CheckedBackground}, | |
| ${FocusedBorderBrush}, | |
| ${FocusedBackground}, | |
| ${TabHeaderStyle}, | |
| ${TabHeaderTemplate}, | |
| ${IsSynchronizedWithCurrentItem}, | |
| [int] | |
| ${SelectedIndex}, | |
| ${SelectedItem}, | |
| ${SelectedValue}, | |
| ${SelectedValuePath}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Expanded}, | |
| [scriptblock[]] | |
| ${On_Collapsed}, | |
| [scriptblock[]] | |
| ${On_SelectionChanged}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.Ribbon | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonMenuButton { | |
| <# | |
| .Example | |
| New-RibbonMenuButton | |
| .Example | |
| New-RibbonMenuButton -OutputXaml | |
| .Example | |
| New-RibbonMenuButton -Show | |
| .Example | |
| New-RibbonMenuButton -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonMenuButton | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonMenuButton | |
| #> | |
| param( | |
| ${Items}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [switch] | |
| ${HasGallery}, | |
| [switch] | |
| ${IsDropDownPositionedAbove}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [switch] | |
| ${IsMainMenu}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_DropDownOpened}, | |
| [scriptblock[]] | |
| ${On_DropDownClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonMenuButton | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonApplicationMenu { | |
| <# | |
| .Example | |
| New-RibbonApplicationMenu | |
| .Example | |
| New-RibbonApplicationMenu -OutputXaml | |
| .Example | |
| New-RibbonApplicationMenu -Show | |
| .Example | |
| New-RibbonApplicationMenu -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonApplicationMenu | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonApplicationMenu | |
| #> | |
| param( | |
| ${Items}, | |
| ${FooterPaneContent}, | |
| ${FooterPaneContentTemplate}, | |
| ${FooterPaneContentTemplateSelector}, | |
| ${AuxiliaryPaneContent}, | |
| ${AuxiliaryPaneContentTemplate}, | |
| ${AuxiliaryPaneContentTemplateSelector}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [switch] | |
| ${HasGallery}, | |
| [switch] | |
| ${IsDropDownPositionedAbove}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [switch] | |
| ${IsMainMenu}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_DropDownOpened}, | |
| [scriptblock[]] | |
| ${On_DropDownClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonApplicationMenu | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonMenuItem { | |
| <# | |
| .Example | |
| New-RibbonMenuItem | |
| .Example | |
| New-RibbonMenuItem -OutputXaml | |
| .Example | |
| New-RibbonMenuItem -Show | |
| .Example | |
| New-RibbonMenuItem -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonMenuItem | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonMenuItem | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ImageSource}, | |
| ${QuickAccessToolBarImageSource}, | |
| [switch] | |
| ${IsDropDownPositionedLeft}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${HasGallery}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [switch] | |
| ${IsSubmenuOpen}, | |
| [switch] | |
| ${IsCheckable}, | |
| [switch] | |
| ${IsPressed}, | |
| [switch] | |
| ${IsHighlighted}, | |
| [switch] | |
| ${IsChecked}, | |
| [switch] | |
| ${StaysOpenOnClick}, | |
| ${InputGestureText}, | |
| ${Icon}, | |
| [switch] | |
| ${IsSuspendingPopupAnimation}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_SubmenuOpened}, | |
| [scriptblock[]] | |
| ${On_SubmenuClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonMenuItem | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonApplicationMenuItem { | |
| <# | |
| .Example | |
| New-RibbonApplicationMenuItem | |
| .Example | |
| New-RibbonApplicationMenuItem -OutputXaml | |
| .Example | |
| New-RibbonApplicationMenuItem -Show | |
| .Example | |
| New-RibbonApplicationMenuItem -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonApplicationMenuItem | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonApplicationMenuItem | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| [System.Windows.Controls.Ribbon.RibbonApplicationMenuItemLevel] | |
| ${Level}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ImageSource}, | |
| ${QuickAccessToolBarImageSource}, | |
| [switch] | |
| ${IsDropDownPositionedLeft}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${HasGallery}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [switch] | |
| ${IsSubmenuOpen}, | |
| [switch] | |
| ${IsCheckable}, | |
| [switch] | |
| ${IsPressed}, | |
| [switch] | |
| ${IsHighlighted}, | |
| [switch] | |
| ${IsChecked}, | |
| [switch] | |
| ${StaysOpenOnClick}, | |
| ${InputGestureText}, | |
| ${Icon}, | |
| [switch] | |
| ${IsSuspendingPopupAnimation}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_SubmenuOpened}, | |
| [scriptblock[]] | |
| ${On_SubmenuClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonApplicationMenuItem | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonSplitMenuItem { | |
| <# | |
| .Example | |
| New-RibbonSplitMenuItem | |
| .Example | |
| New-RibbonSplitMenuItem -OutputXaml | |
| .Example | |
| New-RibbonSplitMenuItem -Show | |
| .Example | |
| New-RibbonSplitMenuItem -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonSplitMenuItem | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonSplitMenuItem | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| ${DropDownToolTipTitle}, | |
| ${DropDownToolTipDescription}, | |
| ${DropDownToolTipImageSource}, | |
| ${DropDownToolTipFooterTitle}, | |
| ${DropDownToolTipFooterDescription}, | |
| ${DropDownToolTipFooterImageSource}, | |
| ${HeaderQuickAccessToolBarId}, | |
| ${HeaderKeyTip}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ImageSource}, | |
| ${QuickAccessToolBarImageSource}, | |
| [switch] | |
| ${IsDropDownPositionedLeft}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${HasGallery}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [switch] | |
| ${IsSubmenuOpen}, | |
| [switch] | |
| ${IsCheckable}, | |
| [switch] | |
| ${IsPressed}, | |
| [switch] | |
| ${IsHighlighted}, | |
| [switch] | |
| ${IsChecked}, | |
| [switch] | |
| ${StaysOpenOnClick}, | |
| ${InputGestureText}, | |
| ${Icon}, | |
| [switch] | |
| ${IsSuspendingPopupAnimation}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_SubmenuOpened}, | |
| [scriptblock[]] | |
| ${On_SubmenuClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonSplitMenuItem | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonApplicationSplitMenuItem { | |
| <# | |
| .Example | |
| New-RibbonApplicationSplitMenuItem | |
| .Example | |
| New-RibbonApplicationSplitMenuItem -OutputXaml | |
| .Example | |
| New-RibbonApplicationSplitMenuItem -Show | |
| .Example | |
| New-RibbonApplicationSplitMenuItem -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonApplicationSplitMenuItem | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonApplicationSplitMenuItem | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| [System.Windows.Controls.Ribbon.RibbonApplicationMenuItemLevel] | |
| ${Level}, | |
| ${DropDownToolTipTitle}, | |
| ${DropDownToolTipDescription}, | |
| ${DropDownToolTipImageSource}, | |
| ${DropDownToolTipFooterTitle}, | |
| ${DropDownToolTipFooterDescription}, | |
| ${DropDownToolTipFooterImageSource}, | |
| ${HeaderQuickAccessToolBarId}, | |
| ${HeaderKeyTip}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ImageSource}, | |
| ${QuickAccessToolBarImageSource}, | |
| [switch] | |
| ${IsDropDownPositionedLeft}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${HasGallery}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [switch] | |
| ${IsSubmenuOpen}, | |
| [switch] | |
| ${IsCheckable}, | |
| [switch] | |
| ${IsPressed}, | |
| [switch] | |
| ${IsHighlighted}, | |
| [switch] | |
| ${IsChecked}, | |
| [switch] | |
| ${StaysOpenOnClick}, | |
| ${InputGestureText}, | |
| ${Icon}, | |
| [switch] | |
| ${IsSuspendingPopupAnimation}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_SubmenuOpened}, | |
| [scriptblock[]] | |
| ${On_SubmenuClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonApplicationSplitMenuItem | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonButton { | |
| <# | |
| .Example | |
| New-RibbonButton | |
| .Example | |
| New-RibbonButton -OutputXaml | |
| .Example | |
| New-RibbonButton -Show | |
| .Example | |
| New-RibbonButton -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonButton | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonButton | |
| #> | |
| param( | |
| ${Content}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${CornerRadius}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [switch] | |
| ${IsDefault}, | |
| [switch] | |
| ${IsCancel}, | |
| [switch] | |
| ${IsPressed}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [System.Windows.Controls.ClickMode] | |
| ${ClickMode}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonButton | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonCheckBox { | |
| <# | |
| .Example | |
| New-RibbonCheckBox | |
| .Example | |
| New-RibbonCheckBox -OutputXaml | |
| .Example | |
| New-RibbonCheckBox -Show | |
| .Example | |
| New-RibbonCheckBox -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonCheckBox | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonCheckBox | |
| #> | |
| param( | |
| ${Content}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${IsChecked}, | |
| [switch] | |
| ${IsThreeState}, | |
| [switch] | |
| ${IsPressed}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [System.Windows.Controls.ClickMode] | |
| ${ClickMode}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_Indeterminate}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonCheckBox | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonComboBox { | |
| <# | |
| .Example | |
| New-RibbonComboBox | |
| .Example | |
| New-RibbonComboBox -OutputXaml | |
| .Example | |
| New-RibbonComboBox -Show | |
| .Example | |
| New-RibbonComboBox -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonComboBox | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonComboBox | |
| #> | |
| param( | |
| ${Items}, | |
| [switch] | |
| ${IsEditable}, | |
| ${Text}, | |
| [switch] | |
| ${IsReadOnly}, | |
| [double] | |
| ${SelectionBoxWidth}, | |
| ${SelectionBoxItem}, | |
| ${SelectionBoxItemTemplate}, | |
| ${SelectionBoxItemTemplateSelector}, | |
| ${SelectionBoxItemStringFormat}, | |
| [switch] | |
| ${StaysOpenOnEdit}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [switch] | |
| ${HasGallery}, | |
| [switch] | |
| ${IsDropDownPositionedAbove}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [switch] | |
| ${IsMainMenu}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_DropDownOpened}, | |
| [scriptblock[]] | |
| ${On_DropDownClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonComboBox | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonContextMenu { | |
| <# | |
| .Example | |
| New-RibbonContextMenu | |
| .Example | |
| New-RibbonContextMenu -OutputXaml | |
| .Example | |
| New-RibbonContextMenu -Show | |
| .Example | |
| New-RibbonContextMenu -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContextMenu | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContextMenu | |
| #> | |
| param( | |
| ${Items}, | |
| [switch] | |
| ${HasGallery}, | |
| [double] | |
| ${HorizontalOffset}, | |
| [double] | |
| ${VerticalOffset}, | |
| [switch] | |
| ${IsOpen}, | |
| ${PlacementTarget}, | |
| ${PlacementRectangle}, | |
| [System.Windows.Controls.Primitives.PlacementMode] | |
| ${Placement}, | |
| [switch] | |
| ${HasDropShadow}, | |
| ${CustomPopupPlacementCallback}, | |
| [switch] | |
| ${StaysOpen}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Opened}, | |
| [scriptblock[]] | |
| ${On_Closed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonContextMenu | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonContextualTabGroup { | |
| <# | |
| .Example | |
| New-RibbonContextualTabGroup | |
| .Example | |
| New-RibbonContextualTabGroup -OutputXaml | |
| .Example | |
| New-RibbonContextualTabGroup -Show | |
| .Example | |
| New-RibbonContextualTabGroup -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContextualTabGroup | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContextualTabGroup | |
| #> | |
| param( | |
| ${Header}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonContextualTabGroup | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonContextualTabGroupItemsControl { | |
| <# | |
| .Example | |
| New-RibbonContextualTabGroupItemsControl | |
| .Example | |
| New-RibbonContextualTabGroupItemsControl -OutputXaml | |
| .Example | |
| New-RibbonContextualTabGroupItemsControl -Show | |
| .Example | |
| New-RibbonContextualTabGroupItemsControl -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContextualTabGroupItemsControl | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContextualTabGroupItemsControl | |
| #> | |
| param( | |
| ${Items}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonContextualTabGroupItemsControl | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonControl { | |
| <# | |
| .Example | |
| New-RibbonControl | |
| .Example | |
| New-RibbonControl -OutputXaml | |
| .Example | |
| New-RibbonControl -Show | |
| .Example | |
| New-RibbonControl -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonControl | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonControl | |
| #> | |
| param( | |
| ${Content}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonControl | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonContentPresenter { | |
| <# | |
| .Example | |
| New-RibbonContentPresenter | |
| .Example | |
| New-RibbonContentPresenter -OutputXaml | |
| .Example | |
| New-RibbonContentPresenter -Show | |
| .Example | |
| New-RibbonContentPresenter -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContentPresenter | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonContentPresenter | |
| #> | |
| param( | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| [switch] | |
| ${RecognizesAccessKey}, | |
| ${Content}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${ContentSource}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonContentPresenter | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonControlGroup { | |
| <# | |
| .Example | |
| New-RibbonControlGroup | |
| .Example | |
| New-RibbonControlGroup -OutputXaml | |
| .Example | |
| New-RibbonControlGroup -Show | |
| .Example | |
| New-RibbonControlGroup -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonControlGroup | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonControlGroup | |
| #> | |
| param( | |
| ${Items}, | |
| ${ControlSizeDefinition}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonControlGroup | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonControlSizeDefinition { | |
| <# | |
| .Example | |
| New-RibbonControlSizeDefinition | |
| .Example | |
| New-RibbonControlSizeDefinition -OutputXaml | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonControlSizeDefinition | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonControlSizeDefinition | |
| #> | |
| param( | |
| [System.Windows.Controls.Ribbon.RibbonImageSize] | |
| ${ImageSize}, | |
| [switch] | |
| ${IsLabelVisible}, | |
| [switch] | |
| ${IsCollapsed}, | |
| ${Width}, | |
| ${MinWidth}, | |
| ${MaxWidth}, | |
| [scriptblock[]] | |
| ${On_Changed}, | |
| [switch] | |
| ${OutputXaml} | |
| ) | |
| begin { | |
| } | |
| process { | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonControlSizeDefinition | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonFilterMenuButton { | |
| <# | |
| .Example | |
| New-RibbonFilterMenuButton | |
| .Example | |
| New-RibbonFilterMenuButton -OutputXaml | |
| .Example | |
| New-RibbonFilterMenuButton -Show | |
| .Example | |
| New-RibbonFilterMenuButton -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonFilterMenuButton | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonFilterMenuButton | |
| #> | |
| param( | |
| ${Items}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [switch] | |
| ${HasGallery}, | |
| [switch] | |
| ${IsDropDownPositionedAbove}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [switch] | |
| ${IsMainMenu}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_DropDownOpened}, | |
| [scriptblock[]] | |
| ${On_DropDownClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonFilterMenuButton | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGallery { | |
| <# | |
| .Example | |
| New-RibbonGallery | |
| .Example | |
| New-RibbonGallery -OutputXaml | |
| .Example | |
| New-RibbonGallery -Show | |
| .Example | |
| New-RibbonGallery -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGallery | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGallery | |
| #> | |
| param( | |
| ${Items}, | |
| [int] | |
| ${MinColumnCount}, | |
| [int] | |
| ${MaxColumnCount}, | |
| [switch] | |
| ${ColumnsStretchToFill}, | |
| [switch] | |
| ${IsSharedColumnSizeScope}, | |
| ${SelectedItem}, | |
| ${SelectedValue}, | |
| ${SelectedValuePath}, | |
| ${IsSynchronizedWithCurrentItem}, | |
| ${HighlightedItem}, | |
| [switch] | |
| ${CanUserFilter}, | |
| ${FilterItemContainerStyle}, | |
| ${AllFilterItemContainerStyle}, | |
| ${FilterItemContainerStyleSelector}, | |
| ${FilterMenuButtonStyle}, | |
| ${FilterPaneContent}, | |
| ${FilterPaneContentTemplate}, | |
| ${FilterItemTemplate}, | |
| ${AllFilterItemTemplate}, | |
| ${FilterItemTemplateSelector}, | |
| ${CategoryTemplate}, | |
| ${CategoryStyle}, | |
| ${GalleryItemTemplate}, | |
| ${GalleryItemStyle}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${PreviewCommandParameter}, | |
| ${CommandTarget}, | |
| ${SmallImageSource}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_SelectionChanged}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonGallery | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGalleryCategory { | |
| <# | |
| .Example | |
| New-RibbonGalleryCategory | |
| .Example | |
| New-RibbonGalleryCategory -OutputXaml | |
| .Example | |
| New-RibbonGalleryCategory -Show | |
| .Example | |
| New-RibbonGalleryCategory -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGalleryCategory | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGalleryCategory | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| [int] | |
| ${MinColumnCount}, | |
| [int] | |
| ${MaxColumnCount}, | |
| [switch] | |
| ${ColumnsStretchToFill}, | |
| [switch] | |
| ${IsSharedColumnSizeScope}, | |
| [System.Windows.Visibility] | |
| ${HeaderVisibility}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonGalleryCategory | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGalleryItem { | |
| <# | |
| .Example | |
| New-RibbonGalleryItem | |
| .Example | |
| New-RibbonGalleryItem -OutputXaml | |
| .Example | |
| New-RibbonGalleryItem -Show | |
| .Example | |
| New-RibbonGalleryItem -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGalleryItem | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGalleryItem | |
| #> | |
| param( | |
| ${Content}, | |
| [switch] | |
| ${IsSelected}, | |
| [switch] | |
| ${IsHighlighted}, | |
| [switch] | |
| ${IsPressed}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${KeyTip}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Selected}, | |
| [scriptblock[]] | |
| ${On_Unselected}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonGalleryItem | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGroup { | |
| <# | |
| .Example | |
| New-RibbonGroup | |
| .Example | |
| New-RibbonGroup -OutputXaml | |
| .Example | |
| New-RibbonGroup -Show | |
| .Example | |
| New-RibbonGroup -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGroup | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGroup | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| [switch] | |
| ${IsCollapsed}, | |
| ${GroupSizeDefinitions}, | |
| ${SmallImageSource}, | |
| ${LargeImageSource}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonGroup | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGroupSizeDefinition { | |
| <# | |
| .Example | |
| New-RibbonGroupSizeDefinition | |
| .Example | |
| New-RibbonGroupSizeDefinition -OutputXaml | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGroupSizeDefinition | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGroupSizeDefinition | |
| #> | |
| param( | |
| ${ControlSizeDefinitions}, | |
| [switch] | |
| ${IsCollapsed}, | |
| [scriptblock[]] | |
| ${On_Changed}, | |
| [switch] | |
| ${OutputXaml} | |
| ) | |
| begin { | |
| } | |
| process { | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonGroupSizeDefinition | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonGroupTemplateSizeDefinition { | |
| <# | |
| .Example | |
| New-RibbonGroupTemplateSizeDefinition | |
| .Example | |
| New-RibbonGroupTemplateSizeDefinition -OutputXaml | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGroupTemplateSizeDefinition | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonGroupTemplateSizeDefinition | |
| #> | |
| param( | |
| ${ContentTemplate}, | |
| [switch] | |
| ${IsCollapsed}, | |
| [scriptblock[]] | |
| ${On_Changed}, | |
| [switch] | |
| ${OutputXaml} | |
| ) | |
| begin { | |
| } | |
| process { | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonGroupTemplateSizeDefinition | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonQuickAccessToolBar { | |
| <# | |
| .Example | |
| New-RibbonQuickAccessToolBar | |
| .Example | |
| New-RibbonQuickAccessToolBar -OutputXaml | |
| .Example | |
| New-RibbonQuickAccessToolBar -Show | |
| .Example | |
| New-RibbonQuickAccessToolBar -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonQuickAccessToolBar | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonQuickAccessToolBar | |
| #> | |
| param( | |
| ${Items}, | |
| [switch] | |
| ${IsOverflowOpen}, | |
| [switch] | |
| ${HasOverflowItems}, | |
| ${CustomizeMenuButton}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonQuickAccessToolBar | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonRadioButton { | |
| <# | |
| .Example | |
| New-RibbonRadioButton | |
| .Example | |
| New-RibbonRadioButton -OutputXaml | |
| .Example | |
| New-RibbonRadioButton -Show | |
| .Example | |
| New-RibbonRadioButton -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonRadioButton | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonRadioButton | |
| #> | |
| param( | |
| ${Content}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${CornerRadius}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${GroupName}, | |
| ${IsChecked}, | |
| [switch] | |
| ${IsThreeState}, | |
| [switch] | |
| ${IsPressed}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [System.Windows.Controls.ClickMode] | |
| ${ClickMode}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_Indeterminate}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonRadioButton | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonSeparator { | |
| <# | |
| .Example | |
| New-RibbonSeparator | |
| .Example | |
| New-RibbonSeparator -OutputXaml | |
| .Example | |
| New-RibbonSeparator -Show | |
| .Example | |
| New-RibbonSeparator -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonSeparator | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonSeparator | |
| #> | |
| param( | |
| ${Label}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonSeparator | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonSplitButton { | |
| <# | |
| .Example | |
| New-RibbonSplitButton | |
| .Example | |
| New-RibbonSplitButton -OutputXaml | |
| .Example | |
| New-RibbonSplitButton -Show | |
| .Example | |
| New-RibbonSplitButton -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonSplitButton | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonSplitButton | |
| #> | |
| param( | |
| ${Items}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${DropDownToolTipTitle}, | |
| ${DropDownToolTipDescription}, | |
| ${DropDownToolTipImageSource}, | |
| ${DropDownToolTipFooterTitle}, | |
| ${DropDownToolTipFooterDescription}, | |
| ${DropDownToolTipFooterImageSource}, | |
| [System.Windows.Controls.Ribbon.RibbonSplitButtonLabelPosition] | |
| ${LabelPosition}, | |
| [switch] | |
| ${IsCheckable}, | |
| [switch] | |
| ${IsChecked}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| ${HeaderQuickAccessToolBarId}, | |
| ${HeaderKeyTip}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| [switch] | |
| ${IsDropDownOpen}, | |
| [double] | |
| ${DropDownHeight}, | |
| [switch] | |
| ${CanUserResizeVertically}, | |
| [switch] | |
| ${CanUserResizeHorizontally}, | |
| [switch] | |
| ${HasGallery}, | |
| [switch] | |
| ${IsDropDownPositionedAbove}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [switch] | |
| ${IsMainMenu}, | |
| ${ItemContainerTemplateSelector}, | |
| [switch] | |
| ${UsesItemContainerTemplate}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_DropDownOpened}, | |
| [scriptblock[]] | |
| ${On_DropDownClosed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonSplitButton | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTab { | |
| <# | |
| .Example | |
| New-RibbonTab | |
| .Example | |
| New-RibbonTab -OutputXaml | |
| .Example | |
| New-RibbonTab -Show | |
| .Example | |
| New-RibbonTab -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTab | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTab | |
| #> | |
| param( | |
| ${Header}, | |
| ${Items}, | |
| ${GroupSizeReductionOrder}, | |
| [switch] | |
| ${IsSelected}, | |
| ${ContextualTabGroupHeader}, | |
| ${ContextualTabGroup}, | |
| ${HeaderStyle}, | |
| [double] | |
| ${TabHeaderLeft}, | |
| [double] | |
| ${TabHeaderRight}, | |
| ${KeyTip}, | |
| ${HeaderTemplate}, | |
| ${HeaderTemplateSelector}, | |
| ${HeaderStringFormat}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonTab | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTabHeader { | |
| <# | |
| .Example | |
| New-RibbonTabHeader | |
| .Example | |
| New-RibbonTabHeader -OutputXaml | |
| .Example | |
| New-RibbonTabHeader -Show | |
| .Example | |
| New-RibbonTabHeader -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTabHeader | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTabHeader | |
| #> | |
| param( | |
| ${Content}, | |
| [switch] | |
| ${IsRibbonTabSelected}, | |
| ${ContextualTabGroup}, | |
| [switch] | |
| ${IsContextualTab}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonTabHeader | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTabHeaderItemsControl { | |
| <# | |
| .Example | |
| New-RibbonTabHeaderItemsControl | |
| .Example | |
| New-RibbonTabHeaderItemsControl -OutputXaml | |
| .Example | |
| New-RibbonTabHeaderItemsControl -Show | |
| .Example | |
| New-RibbonTabHeaderItemsControl -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTabHeaderItemsControl | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTabHeaderItemsControl | |
| #> | |
| param( | |
| ${Items}, | |
| ${ItemsSource}, | |
| ${DisplayMemberPath}, | |
| ${ItemTemplate}, | |
| ${ItemTemplateSelector}, | |
| ${ItemStringFormat}, | |
| ${ItemBindingGroup}, | |
| ${ItemContainerStyle}, | |
| ${ItemContainerStyleSelector}, | |
| ${ItemsPanel}, | |
| ${GroupStyle}, | |
| ${GroupStyleSelector}, | |
| [int] | |
| ${AlternationCount}, | |
| [switch] | |
| ${IsTextSearchEnabled}, | |
| [switch] | |
| ${IsTextSearchCaseSensitive}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonTabHeaderItemsControl | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTextBox { | |
| <# | |
| .Example | |
| New-RibbonTextBox | |
| .Example | |
| New-RibbonTextBox -OutputXaml | |
| .Example | |
| New-RibbonTextBox -Show | |
| .Example | |
| New-RibbonTextBox -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTextBox | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTextBox | |
| #> | |
| param( | |
| ${Text}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| [double] | |
| ${TextBoxWidth}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| [System.Windows.TextWrapping] | |
| ${TextWrapping}, | |
| [int] | |
| ${MinLines}, | |
| [int] | |
| ${MaxLines}, | |
| [System.Windows.Controls.CharacterCasing] | |
| ${CharacterCasing}, | |
| [int] | |
| ${MaxLength}, | |
| [System.Windows.TextAlignment] | |
| ${TextAlignment}, | |
| ${SelectedText}, | |
| [int] | |
| ${SelectionLength}, | |
| [int] | |
| ${SelectionStart}, | |
| [int] | |
| ${CaretIndex}, | |
| ${TextDecorations}, | |
| [switch] | |
| ${IsReadOnly}, | |
| [switch] | |
| ${IsReadOnlyCaretVisible}, | |
| [switch] | |
| ${AcceptsReturn}, | |
| [switch] | |
| ${AcceptsTab}, | |
| [System.Windows.Controls.ScrollBarVisibility] | |
| ${HorizontalScrollBarVisibility}, | |
| [System.Windows.Controls.ScrollBarVisibility] | |
| ${VerticalScrollBarVisibility}, | |
| [switch] | |
| ${IsUndoEnabled}, | |
| [int] | |
| ${UndoLimit}, | |
| [switch] | |
| ${AutoWordSelection}, | |
| ${SelectionBrush}, | |
| [double] | |
| ${SelectionOpacity}, | |
| ${CaretBrush}, | |
| [switch] | |
| ${IsInactiveSelectionHighlightEnabled}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_TextChanged}, | |
| [scriptblock[]] | |
| ${On_SelectionChanged}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonTextBox | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonToggleButton { | |
| <# | |
| .Example | |
| New-RibbonToggleButton | |
| .Example | |
| New-RibbonToggleButton -OutputXaml | |
| .Example | |
| New-RibbonToggleButton -Show | |
| .Example | |
| New-RibbonToggleButton -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonToggleButton | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonToggleButton | |
| #> | |
| param( | |
| ${Content}, | |
| ${LargeImageSource}, | |
| ${SmallImageSource}, | |
| ${Label}, | |
| ${ToolTipTitle}, | |
| ${ToolTipDescription}, | |
| ${ToolTipImageSource}, | |
| ${ToolTipFooterTitle}, | |
| ${ToolTipFooterDescription}, | |
| ${ToolTipFooterImageSource}, | |
| ${CornerRadius}, | |
| ${ControlSizeDefinition}, | |
| [switch] | |
| ${IsInControlGroup}, | |
| ${QuickAccessToolBarControlSizeDefinition}, | |
| [switch] | |
| ${IsInQuickAccessToolBar}, | |
| ${MouseOverBorderBrush}, | |
| ${MouseOverBackground}, | |
| ${PressedBorderBrush}, | |
| ${PressedBackground}, | |
| ${CheckedBackground}, | |
| ${CheckedBorderBrush}, | |
| ${FocusedBackground}, | |
| ${FocusedBorderBrush}, | |
| ${QuickAccessToolBarId}, | |
| [switch] | |
| ${CanAddToQuickAccessToolBarDirectly}, | |
| ${KeyTip}, | |
| ${IsChecked}, | |
| [switch] | |
| ${IsThreeState}, | |
| [switch] | |
| ${IsPressed}, | |
| ${Command}, | |
| ${CommandParameter}, | |
| ${CommandTarget}, | |
| [System.Windows.Controls.ClickMode] | |
| ${ClickMode}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Checked}, | |
| [scriptblock[]] | |
| ${On_Unchecked}, | |
| [scriptblock[]] | |
| ${On_Indeterminate}, | |
| [scriptblock[]] | |
| ${On_Click}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonToggleButton | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| if ($command -is [string]) { | |
| $module =$myInvocation.MyCommand.Module.ModuleName | |
| $cmd = | |
| Get-Command "Get-*Command" -Module $module | | |
| Where-Object { $_.Parameters.$Command } | |
| if ($cmd) { | |
| $params = @{$Command = $true} | |
| $psBoundParameters.Command = & $cmd @Params | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonToolTip { | |
| <# | |
| .Example | |
| New-RibbonToolTip | |
| .Example | |
| New-RibbonToolTip -OutputXaml | |
| .Example | |
| New-RibbonToolTip -Show | |
| .Example | |
| New-RibbonToolTip -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonToolTip | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonToolTip | |
| #> | |
| param( | |
| ${Content}, | |
| ${Ribbon}, | |
| ${Title}, | |
| ${Description}, | |
| ${ImageSource}, | |
| [switch] | |
| ${HasHeader}, | |
| ${FooterTitle}, | |
| ${FooterDescription}, | |
| ${FooterImageSource}, | |
| [switch] | |
| ${HasFooter}, | |
| [switch] | |
| ${IsPlacementTargetInRibbonGroup}, | |
| [double] | |
| ${HorizontalOffset}, | |
| [double] | |
| ${VerticalOffset}, | |
| [switch] | |
| ${IsOpen}, | |
| [switch] | |
| ${HasDropShadow}, | |
| ${PlacementTarget}, | |
| ${PlacementRectangle}, | |
| [System.Windows.Controls.Primitives.PlacementMode] | |
| ${Placement}, | |
| ${CustomPopupPlacementCallback}, | |
| [switch] | |
| ${StaysOpen}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_Opened}, | |
| [scriptblock[]] | |
| ${On_Closed}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonToolTip | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonTwoLineText { | |
| <# | |
| .Example | |
| New-RibbonTwoLineText | |
| .Example | |
| New-RibbonTwoLineText -OutputXaml | |
| .Example | |
| New-RibbonTwoLineText -Show | |
| .Example | |
| New-RibbonTwoLineText -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTwoLineText | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonTwoLineText | |
| #> | |
| param( | |
| ${TextDecorations}, | |
| ${TextEffects}, | |
| [double] | |
| ${BaselineOffset}, | |
| ${Padding}, | |
| [System.Windows.TextAlignment] | |
| ${TextAlignment}, | |
| [System.Windows.TextTrimming] | |
| ${TextTrimming}, | |
| [double] | |
| ${LineHeight}, | |
| [System.Windows.LineStackingStrategy] | |
| ${LineStackingStrategy}, | |
| ${PathFill}, | |
| ${PathStroke}, | |
| ${Text}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonTwoLineText | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Left")) { | |
| $object.SetValue([Windows.Controls.Canvas]::LeftProperty, $Left) | |
| $Null = $PSBoundParameters.Remove("Left") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Top")) { | |
| $object.SetValue([Windows.Controls.Canvas]::TopProperty, $top) | |
| $Null = $PSBoundParameters.Remove("Top") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| function New-RibbonWindow { | |
| <# | |
| .Example | |
| New-RibbonWindow | |
| .Example | |
| New-RibbonWindow -OutputXaml | |
| .Example | |
| New-RibbonWindow -Show | |
| .Example | |
| New-RibbonWindow -AsJob | |
| .Description | |
| Creates a new System.Windows.Controls.Ribbon.RibbonWindow | |
| .Parameter OutputXaml | |
| If Set, will output the object as XAML instead of creating it | |
| .Parameter AsJob | |
| If Set, will show the visual in a background WPF Job | |
| .Parameter Resource | |
| A Dictionary of Resources. Use this dictionary to store information that | |
| the rest of the user interface needs to access. | |
| .Parameter Show | |
| If Set, will show the visual in a new window | |
| .Synopsis | |
| Creates a new System.Windows.Controls.Ribbon.RibbonWindow | |
| #> | |
| param( | |
| ${Content}, | |
| ${TaskbarItemInfo}, | |
| [switch] | |
| ${AllowsTransparency}, | |
| ${Title}, | |
| ${Icon}, | |
| [System.Windows.SizeToContent] | |
| ${SizeToContent}, | |
| [double] | |
| ${Top}, | |
| [double] | |
| ${Left}, | |
| [System.Windows.WindowStartupLocation] | |
| ${WindowStartupLocation}, | |
| [switch] | |
| ${ShowInTaskbar}, | |
| ${Owner}, | |
| ${DialogResult}, | |
| [System.Windows.WindowStyle] | |
| ${WindowStyle}, | |
| [System.Windows.WindowState] | |
| ${WindowState}, | |
| [System.Windows.ResizeMode] | |
| ${ResizeMode}, | |
| [switch] | |
| ${Topmost}, | |
| [switch] | |
| ${ShowActivated}, | |
| ${ContentTemplate}, | |
| ${ContentTemplateSelector}, | |
| ${ContentStringFormat}, | |
| ${BorderBrush}, | |
| ${BorderThickness}, | |
| ${Background}, | |
| ${Foreground}, | |
| ${FontFamily}, | |
| [double] | |
| ${FontSize}, | |
| ${FontStretch}, | |
| ${FontStyle}, | |
| ${FontWeight}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalContentAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalContentAlignment}, | |
| [int] | |
| ${TabIndex}, | |
| [switch] | |
| ${IsTabStop}, | |
| ${Padding}, | |
| ${Template}, | |
| ${Style}, | |
| [switch] | |
| ${OverridesDefaultStyle}, | |
| [switch] | |
| ${UseLayoutRounding}, | |
| ${Triggers}, | |
| ${DataContext}, | |
| ${BindingGroup}, | |
| ${Language}, | |
| ${Name}, | |
| ${Tag}, | |
| ${InputScope}, | |
| ${LayoutTransform}, | |
| [double] | |
| ${Width}, | |
| [double] | |
| ${MinWidth}, | |
| [double] | |
| ${MaxWidth}, | |
| [double] | |
| ${Height}, | |
| [double] | |
| ${MinHeight}, | |
| [double] | |
| ${MaxHeight}, | |
| [System.Windows.FlowDirection] | |
| ${FlowDirection}, | |
| ${Margin}, | |
| [System.Windows.HorizontalAlignment] | |
| ${HorizontalAlignment}, | |
| [System.Windows.VerticalAlignment] | |
| ${VerticalAlignment}, | |
| ${FocusVisualStyle}, | |
| ${Cursor}, | |
| [switch] | |
| ${ForceCursor}, | |
| ${ToolTip}, | |
| ${ContextMenu}, | |
| ${InputBindings}, | |
| ${CommandBindings}, | |
| [switch] | |
| ${AllowDrop}, | |
| ${RenderSize}, | |
| ${RenderTransform}, | |
| ${RenderTransformOrigin}, | |
| [double] | |
| ${Opacity}, | |
| ${OpacityMask}, | |
| ${BitmapEffect}, | |
| ${Effect}, | |
| ${BitmapEffectInput}, | |
| ${CacheMode}, | |
| ${Uid}, | |
| [System.Windows.Visibility] | |
| ${Visibility}, | |
| [switch] | |
| ${ClipToBounds}, | |
| ${Clip}, | |
| [switch] | |
| ${SnapsToDevicePixels}, | |
| [switch] | |
| ${IsEnabled}, | |
| [switch] | |
| ${IsHitTestVisible}, | |
| [switch] | |
| ${Focusable}, | |
| [switch] | |
| ${IsManipulationEnabled}, | |
| [scriptblock[]] | |
| ${On_SourceInitialized}, | |
| [scriptblock[]] | |
| ${On_Activated}, | |
| [scriptblock[]] | |
| ${On_Deactivated}, | |
| [scriptblock[]] | |
| ${On_StateChanged}, | |
| [scriptblock[]] | |
| ${On_LocationChanged}, | |
| [scriptblock[]] | |
| ${On_Closing}, | |
| [scriptblock[]] | |
| ${On_Closed}, | |
| [scriptblock[]] | |
| ${On_ContentRendered}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_MouseDoubleClick}, | |
| [scriptblock[]] | |
| ${On_TargetUpdated}, | |
| [scriptblock[]] | |
| ${On_SourceUpdated}, | |
| [scriptblock[]] | |
| ${On_DataContextChanged}, | |
| [scriptblock[]] | |
| ${On_RequestBringIntoView}, | |
| [scriptblock[]] | |
| ${On_SizeChanged}, | |
| [scriptblock[]] | |
| ${On_Initialized}, | |
| [scriptblock[]] | |
| ${On_Loaded}, | |
| [scriptblock[]] | |
| ${On_Unloaded}, | |
| [scriptblock[]] | |
| ${On_ToolTipOpening}, | |
| [scriptblock[]] | |
| ${On_ToolTipClosing}, | |
| [scriptblock[]] | |
| ${On_ContextMenuOpening}, | |
| [scriptblock[]] | |
| ${On_ContextMenuClosing}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseDown}, | |
| [scriptblock[]] | |
| ${On_MouseDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseUp}, | |
| [scriptblock[]] | |
| ${On_MouseUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseLeftButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_MouseRightButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseMove}, | |
| [scriptblock[]] | |
| ${On_MouseMove}, | |
| [scriptblock[]] | |
| ${On_PreviewMouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseWheel}, | |
| [scriptblock[]] | |
| ${On_MouseEnter}, | |
| [scriptblock[]] | |
| ${On_MouseLeave}, | |
| [scriptblock[]] | |
| ${On_GotMouseCapture}, | |
| [scriptblock[]] | |
| ${On_LostMouseCapture}, | |
| [scriptblock[]] | |
| ${On_QueryCursor}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusDown}, | |
| [scriptblock[]] | |
| ${On_StylusDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusUp}, | |
| [scriptblock[]] | |
| ${On_StylusUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusMove}, | |
| [scriptblock[]] | |
| ${On_StylusMove}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusInAirMove}, | |
| [scriptblock[]] | |
| ${On_StylusEnter}, | |
| [scriptblock[]] | |
| ${On_StylusLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusInRange}, | |
| [scriptblock[]] | |
| ${On_StylusInRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_StylusOutOfRange}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_StylusSystemGesture}, | |
| [scriptblock[]] | |
| ${On_GotStylusCapture}, | |
| [scriptblock[]] | |
| ${On_LostStylusCapture}, | |
| [scriptblock[]] | |
| ${On_StylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_StylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonDown}, | |
| [scriptblock[]] | |
| ${On_PreviewStylusButtonUp}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyDown}, | |
| [scriptblock[]] | |
| ${On_KeyDown}, | |
| [scriptblock[]] | |
| ${On_PreviewKeyUp}, | |
| [scriptblock[]] | |
| ${On_KeyUp}, | |
| [scriptblock[]] | |
| ${On_PreviewGotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_GotKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewLostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_LostKeyboardFocus}, | |
| [scriptblock[]] | |
| ${On_PreviewTextInput}, | |
| [scriptblock[]] | |
| ${On_TextInput}, | |
| [scriptblock[]] | |
| ${On_PreviewQueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_QueryContinueDrag}, | |
| [scriptblock[]] | |
| ${On_PreviewGiveFeedback}, | |
| [scriptblock[]] | |
| ${On_GiveFeedback}, | |
| [scriptblock[]] | |
| ${On_PreviewDragEnter}, | |
| [scriptblock[]] | |
| ${On_DragEnter}, | |
| [scriptblock[]] | |
| ${On_PreviewDragOver}, | |
| [scriptblock[]] | |
| ${On_DragOver}, | |
| [scriptblock[]] | |
| ${On_PreviewDragLeave}, | |
| [scriptblock[]] | |
| ${On_DragLeave}, | |
| [scriptblock[]] | |
| ${On_PreviewDrop}, | |
| [scriptblock[]] | |
| ${On_Drop}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchDown}, | |
| [scriptblock[]] | |
| ${On_TouchDown}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchMove}, | |
| [scriptblock[]] | |
| ${On_TouchMove}, | |
| [scriptblock[]] | |
| ${On_PreviewTouchUp}, | |
| [scriptblock[]] | |
| ${On_TouchUp}, | |
| [scriptblock[]] | |
| ${On_GotTouchCapture}, | |
| [scriptblock[]] | |
| ${On_LostTouchCapture}, | |
| [scriptblock[]] | |
| ${On_TouchEnter}, | |
| [scriptblock[]] | |
| ${On_TouchLeave}, | |
| [scriptblock[]] | |
| ${On_IsMouseDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsMouseCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusDirectlyOverChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCapturedChanged}, | |
| [scriptblock[]] | |
| ${On_IsStylusCaptureWithinChanged}, | |
| [scriptblock[]] | |
| ${On_IsKeyboardFocusedChanged}, | |
| [scriptblock[]] | |
| ${On_LayoutUpdated}, | |
| [scriptblock[]] | |
| ${On_GotFocus}, | |
| [scriptblock[]] | |
| ${On_LostFocus}, | |
| [scriptblock[]] | |
| ${On_IsEnabledChanged}, | |
| [scriptblock[]] | |
| ${On_IsHitTestVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_IsVisibleChanged}, | |
| [scriptblock[]] | |
| ${On_FocusableChanged}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationStarted}, | |
| [scriptblock[]] | |
| ${On_ManipulationDelta}, | |
| [scriptblock[]] | |
| ${On_ManipulationInertiaStarting}, | |
| [scriptblock[]] | |
| ${On_ManipulationBoundaryFeedback}, | |
| [scriptblock[]] | |
| ${On_ManipulationCompleted}, | |
| [switch] | |
| ${OutputXaml}, | |
| [hashtable] | |
| ${Resource}, | |
| [hashtable] | |
| ${DataBinding}, | |
| [hashtable] | |
| ${RoutedEvent}, | |
| [string] | |
| ${ControlName}, | |
| [Alias('UIStyle')] | |
| [string] | |
| ${VisualStyle}, | |
| [switch] | |
| ${Show}, | |
| [switch] | |
| ${ShowUI}, | |
| [int] | |
| ${Row}, | |
| [int] | |
| ${Column}, | |
| [int] | |
| ${RowSpan}, | |
| [int] | |
| ${ColumnSpan}, | |
| [int] | |
| ${ZIndex}, | |
| [System.Windows.Controls.Dock] | |
| ${Dock}, | |
| [switch] | |
| ${AsJob} | |
| ) | |
| begin { | |
| } | |
| process { | |
| if ($PSBoundParameters.ContainsKey("AsJob")) { | |
| $null = $psBoundParameters.Remove("AsJob") | |
| $ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| $Command = $MyInvocation.InvocationName | |
| if (-not $Command) { | |
| $Command = "Start-WPFJob" | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey('Resource')) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $psBoundParameters.Resource = $parentFunctionParameters | |
| } | |
| } | |
| $Parameters = $PSBoundParameters | |
| $AdditionalContext = @(Get-PSCallstack)[1].InvocationInfo.MyCommand.Definition | |
| if (-not $AdditionalContext) { $AdditionalContext += {} } | |
| if ($AdditionalContext -like "*.ps1") { | |
| $AdditionalContext = [ScriptBlock]::Create( | |
| [IO.File]::ReadAllText($AdditionalContext) | |
| ) | |
| } else { | |
| $AdditionalContext = [ScriptBlock]::Create($AdditionalContext) | |
| } | |
| $JobParameters = @{ | |
| ScriptBlock = $MyInvocation.MyCommand.ScriptBlock | |
| Command = $Command | |
| AdditionalContext = $AdditionalContext | |
| Name = $Name | |
| } | |
| if (-not $JobParameters.Name) { | |
| $JobParameters.Name = $MyInvocation.InvocationName | |
| } | |
| if ($Parameters) { | |
| Start-WPFJob @JobParameters -Parameter $Parameters | |
| } else { | |
| Start-WPFJob @JobParameters | |
| } | |
| return | |
| } | |
| try { | |
| $Object = New-Object System.Windows.Controls.Ribbon.RibbonWindow | |
| } catch { | |
| throw $_ | |
| return | |
| } | |
| if ($PSBoundParameters.ContainsKey("Row")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowProperty, $row) | |
| $Null = $PSBoundParameters.Remove("Row") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Column")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnProperty, $column) | |
| $Null = $PSBoundParameters.Remove("Column") | |
| } | |
| if ($PSBoundParameters.ContainsKey("RowSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::RowSpanProperty, $rowSpan) | |
| $Null = $PSBoundParameters.Remove("RowSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ColumnSpan")) { | |
| $Object.SetValue([Windows.Controls.Grid]::ColumnSpanProperty, $columnSpan) | |
| $Null = $PSBoundParameters.Remove("ColumnSpan") | |
| } | |
| if ($PSBoundParameters.ContainsKey("ZIndex")) { | |
| $Object.SetValue([Windows.Controls.Panel]::ZIndexProperty, $ZIndex) | |
| $Null = $PSBoundParameters.Remove("ZIndex") | |
| } | |
| if ($PSBoundParameters.ContainsKey("Dock")) { | |
| $Object.SetValue([Windows.Controls.DockPanel]::DockProperty, $Dock) | |
| $Null = $PSBoundParameters.Remove("Dock") | |
| } | |
| if ($PSBoundParameters.ContainsKey("VisualStyle")) { | |
| $Object.SetValue([ShowUI.ShowUISetting]::StyleNameProperty, $PSBoundParameters.VisualStyle) | |
| $Null = $PSBoundParameters.Remove("VisualStyle") | |
| } | |
| $null = $psBoundParameters.Remove("Show") | |
| if ($PsBoundParameters.ContainsKey("RoutedEvent")) { | |
| $null = $PsBoundParameters.Remove("RoutedEvent") | |
| foreach ($re in $RoutedEvent.GetEnumerator()) { | |
| if ($re.Key -is [Windows.RoutedEvent]) { | |
| $Null = $Object.AddHandler($re.Key, $re.Value -as $re.Key.HandlerType) | |
| } else { | |
| $Event = $object.GetType()::"$($re.Key)Event" | |
| if ($Event) { | |
| $null = $Object.AddHandler( | |
| $Event, | |
| $re.Value -as $Event.HandlerType | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $Object.Resources.Timers = | |
| New-Object Collections.Generic.Dictionary["string,Windows.Threading.DispatcherTimer"] | |
| $Object.Resources.TemporaryControls = @{} | |
| $Object.Resources.Scripts = | |
| New-Object Collections.Generic.Dictionary["string,ScriptBlock"] | |
| $Object.Uid = [GUID]::NewGuid() | |
| if ($psBoundParameters.ContainsKey("DataBinding")) { | |
| $null = $psBoundParameters.Remove("DataBinding") | |
| foreach ($db in $DataBinding.GetEnumerator()) { | |
| if ($db.Key -is [Windows.DependencyProperty]) { | |
| $Null = $Object.SetBinding($db.Key, $db.Value) | |
| } else { | |
| $Prop = $Object.GetType()::"$($db.Key)Property" | |
| if ($Prop) { | |
| Write-Debug ( | |
| $Object.SetBinding( | |
| $Prop, | |
| $db.Value) | Out-String | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| $parentFunctionParameters = | |
| try { | |
| Get-Variable -Name psboundparameters -ValueOnly -Scope 1 -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($parentFunctionParameters) { | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $parentFunctionParameters.GetEnumerator()) { | |
| if (-not $psBoundParameters.Resource.ContainsKey($kv.Key)) { | |
| $psBoundParameters.Resource[$kv.Key] = $kv.Value | |
| } | |
| } | |
| } else { | |
| $null = $psBoundParameters.Add("Resource", (@{} + $parentFunctionParameters)) | |
| } | |
| } | |
| if ($psBoundParameters.ContainsKey("Resource")) { | |
| foreach ($kv in $psBoundParameters['Resource'].GetEnumerator()) | |
| { | |
| $null = $object.Resources.Add($kv.Key, $kv.Value) | |
| if ('Object', 'psBoundParameters','Show','AsJob','OutputXaml' -notcontains $kv.Key -and | |
| $psBoundParameters.Keys -notcontains $kv.Key) { | |
| Set-Variable -Name $kv.Key -Value $kv.Value | |
| } | |
| } | |
| } | |
| Set-Property -property $psBoundParameters -inputObject $Object | |
| if ($outputXaml) { | |
| return $object | Out-Xaml -Flash | |
| } | |
| if ($ControlName) { | |
| $object.SetValue([ShowUI.ShowUISetting]::ControlNameProperty, $ControlName) | |
| } | |
| if ($show -or $showUI) { | |
| return Show-Window $Object | |
| } | |
| Write-Output (,$Object) | |
| } | |
| end { | |
| } | |
| } | |
| Set-Alias -Name KeyTipControl -Value New-KeyTipControl | |
| Set-Alias -Name RibbonContextualTabGroupsPanel -Value New-RibbonContextualTabGroupsPanel | |
| Set-Alias -Name RibbonGalleryCategoriesPanel -Value New-RibbonGalleryCategoriesPanel | |
| Set-Alias -Name RibbonGalleryItemsPanel -Value New-RibbonGalleryItemsPanel | |
| Set-Alias -Name RibbonGroupItemsPanel -Value New-RibbonGroupItemsPanel | |
| Set-Alias -Name RibbonGroupsPanel -Value New-RibbonGroupsPanel | |
| Set-Alias -Name RibbonMenuItemsPanel -Value New-RibbonMenuItemsPanel | |
| Set-Alias -Name RibbonQuickAccessToolBarOverflowPanel -Value New-RibbonQuickAccessToolBarOverflowPanel | |
| Set-Alias -Name RibbonQuickAccessToolBarPanel -Value New-RibbonQuickAccessToolBarPanel | |
| Set-Alias -Name RibbonTabHeadersPanel -Value New-RibbonTabHeadersPanel | |
| Set-Alias -Name RibbonTabsPanel -Value New-RibbonTabsPanel | |
| Set-Alias -Name RibbonTitlePanel -Value New-RibbonTitlePanel | |
| Set-Alias -Name StarLayoutInfo -Value New-StarLayoutInfo | |
| Set-Alias -Name Ribbon -Value New-Ribbon | |
| Set-Alias -Name RibbonMenuButton -Value New-RibbonMenuButton | |
| Set-Alias -Name RibbonApplicationMenu -Value New-RibbonApplicationMenu | |
| Set-Alias -Name RibbonMenuItem -Value New-RibbonMenuItem | |
| Set-Alias -Name RibbonApplicationMenuItem -Value New-RibbonApplicationMenuItem | |
| Set-Alias -Name RibbonSplitMenuItem -Value New-RibbonSplitMenuItem | |
| Set-Alias -Name RibbonApplicationSplitMenuItem -Value New-RibbonApplicationSplitMenuItem | |
| Set-Alias -Name RibbonButton -Value New-RibbonButton | |
| Set-Alias -Name RibbonCheckBox -Value New-RibbonCheckBox | |
| Set-Alias -Name RibbonComboBox -Value New-RibbonComboBox | |
| Set-Alias -Name RibbonContextMenu -Value New-RibbonContextMenu | |
| Set-Alias -Name RibbonContextualTabGroup -Value New-RibbonContextualTabGroup | |
| Set-Alias -Name RibbonContextualTabGroupItemsControl -Value New-RibbonContextualTabGroupItemsControl | |
| Set-Alias -Name RibbonControl -Value New-RibbonControl | |
| Set-Alias -Name RibbonContentPresenter -Value New-RibbonContentPresenter | |
| Set-Alias -Name RibbonControlGroup -Value New-RibbonControlGroup | |
| Set-Alias -Name RibbonControlSizeDefinition -Value New-RibbonControlSizeDefinition | |
| Set-Alias -Name RibbonFilterMenuButton -Value New-RibbonFilterMenuButton | |
| Set-Alias -Name RibbonGallery -Value New-RibbonGallery | |
| Set-Alias -Name RibbonGalleryCategory -Value New-RibbonGalleryCategory | |
| Set-Alias -Name RibbonGalleryItem -Value New-RibbonGalleryItem | |
| Set-Alias -Name RibbonGroup -Value New-RibbonGroup | |
| Set-Alias -Name RibbonGroupSizeDefinition -Value New-RibbonGroupSizeDefinition | |
| Set-Alias -Name RibbonGroupTemplateSizeDefinition -Value New-RibbonGroupTemplateSizeDefinition | |
| Set-Alias -Name RibbonQuickAccessToolBar -Value New-RibbonQuickAccessToolBar | |
| Set-Alias -Name RibbonRadioButton -Value New-RibbonRadioButton | |
| Set-Alias -Name RibbonSeparator -Value New-RibbonSeparator | |
| Set-Alias -Name RibbonSplitButton -Value New-RibbonSplitButton | |
| Set-Alias -Name RibbonTab -Value New-RibbonTab | |
| Set-Alias -Name RibbonTabHeader -Value New-RibbonTabHeader | |
| Set-Alias -Name RibbonTabHeaderItemsControl -Value New-RibbonTabHeaderItemsControl | |
| Set-Alias -Name RibbonTextBox -Value New-RibbonTextBox | |
| Set-Alias -Name RibbonToggleButton -Value New-RibbonToggleButton | |
| Set-Alias -Name RibbonToolTip -Value New-RibbonToolTip | |
| Set-Alias -Name RibbonTwoLineText -Value New-RibbonTwoLineText | |
| Set-Alias -Name RibbonWindow -Value New-RibbonWindow | |
| Export-ModuleMember -Cmdlet * -Function * -Alias * | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Requires -Modules @{ModuleName="ShowUI"; ModuleVersion="1.4"}, @{ModuleName="Ribbon"; ModuleVersion="1.0"} | |
| ## The Ribbon control is new in .Net 4.5 and has it's own assembly | |
| ## You only have to Add-UIModule once to get the Ribbon module if it doesn't exist: | |
| # Add-UIModule -AssemblyName System.Windows.Controls.Ribbon -Name Ribbon | |
| # Note, the images can be any kind of image, and can be local file paths, | |
| # but since they have to exist, I'll use URLs for now | |
| RibbonWindow { | |
| Ribbon -QuickAccessToolbar { | |
| RibbonQuickAccessToolBar { | |
| RibbonButton -ToolTip "Button 1" -SmallImageSource "http://huddledmasses.org/images/icons/admin_shell.ico" | |
| } | |
| } -Items { | |
| RibbonTab -Header "Task A" { | |
| RibbonGroup -Header "PoshCode" { | |
| # The ImageSource needs to be a path to an image... | |
| RibbonButton -LargeImageSource "http://huddledmasses.org/images/icons/PoshCode.png" -Label "PoshCode" | |
| } | |
| } | |
| RibbonTab -Header "Task B" | |
| } | |
| } -Title "My Window" -Show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment