Skip to content
Avalonia bindings for PowerShell
PowerShell C#
Branch: master
Clone or download
Latest commit 1f04c38 Jun 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images Initial Commit Jun 17, 2019
src
.gitignore Initial Commit Jun 17, 2019
LICENSE
README.md Initial Commit Jun 17, 2019

README.md

PSAvalonia

Avalonia bindings for PowerShell

Avalonia

Avalonia is a WPF-style, cross-platform UI library. It works with .NET Core and on Linux, Windows and MacOS.

Available Commands

  • Show-AvaloniaWindow
  • ConvertTo-AvaloniaWindow
  • Find-AvaloniaControl

Example

$Xaml = '<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="avaloniaui.MainWindow"
        Title="avaloniaui">
   <StackPanel>
	<Button Width="160" Name="button">My Button</Button>
        <TextBox HorizontalAlignment="Left" Margin="12,12,0,0" Name="txtDemo" VerticalAlignment="Top" Width="500" Height="25" />
    </StackPanel>
</Window>'
$window = ConvertTo-AvaloniaWindow -Xaml $Xaml
$Button = Find-AvaloniaControl -Name 'button' -Window $Window
$txtDemo = Find-AvaloniaControl -Name 'txtDemo' -Window $Window
$Button.add_Click({$txtDemo.Text = "Hello, World from $($PSVersionTable.OS) running PowerShell Core $($PSVersionTable.PSVersion)"})
Show-AvaloniaWindow -Window $Window

Script Running on Windows

Script Running on Linux

Supported PowerShell Versions

  • 6.2
  • 7.0
You can’t perform that action at this time.