XAML button to call a PS function

  • Thread starter Thread starter D3K
  • Start date Start date

D3K

D3K

Soldato
Joined
13 Nov 2014
Posts
3,883
I'm working with a customiseable addin that uses XAML and Powershell.

In the XAML file, there is some dynamic functionality that is using the PS functions from selection sets, but no buttons.

I've added a button, and a new powershell function, but I cannot seem to get it to work.
I'm sure I need to add in Command= " " to the following button definition, but not sure of the format.

Code:
 <Button x:Name="FolderBrowse" Content="..." HorizontalAlignment="Left" Margin="306,0,0,0" Grid.Row="3" VerticalAlignment="Top" Width="24" Height="24" BorderThickness="1" Grid.Column="1" />


The powershell function is this:
Code:
function BrowseFolder
{
Add-Type -AssemblyName System.Windows.Forms
$FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
[void]$FolderBrowser.ShowDialog()
$FolderBrowser.SelectedPath
}


The other functions seem to be called from either "PSCmd", "PSList", or "PSVal". Are these common, or are they unique to this addin?
 
Back
Top Bottom