Powershell 「Use Grid and StackPanel to create a simple weather app(microsoft grid-tutorial)」のPowershell対応

PowerShell

Microsoftの「Use Grid and StackPanel to create a simple weather app」にあるxamlをつかった画面をPowershellで実行できるよう修正した例

サンプルコード

チュートリアルでは、partially-cloudy.png の扱い方が Visual studio前提となっている。

のソリューション エクスプローラーで Assets フォルダーを右クリックし、[追加] ->[既存の項目…] を選択します。ポップアップ表示されるブラウザーで partially-cloudy.png を見つけて選択し、[追加] を選択します。

Grid と StackPanel を使った単純なアプリの作成。 – Windows apps | Microsoft Docs

しかし、PowershellではVisual studioの上記のような使い方が機能しないので、Ps1ファイル上で、自身の実行パスから、partially-cloudy.png 用の絶対パスを生成し、$Image.Sourceに設定するようにした。

実行結果

チュートリアル Use Grid and StackPanel to create a simple weather app

Use Grid and StackPanel to create a simple app. - Windows apps
This tutorial walks through how to create a basic application user interface. It explains and demonstrates the use of Gr...

github

PowerShell_WPF_XAML_GUI_SampleCodes/WPF_SimpleWeatherFormSample at main ?? papanda925/PowerShell_WPF_XAML_GUI_SampleCodes
PowerShell_WPF_XAML_GUI_SampleCodes. Contribute to papanda925/PowerShell_WPF_XAML_GUI_SampleCodes development by creatin...

最近、XamlによるGUIを使ったpoershellアプリに興味あり

文書情報

記事タイトル
Powershell 「Use Grid and StackPanel to create a simple weather app(microsoft grid-tutorial)」のPowershell対応
作成日
更新日
Source URL
https://papanda925.com/?p=2143

ライセンス: 本記事のうち、当サイトが権利を有する本文・自作図表は、特記なき限り CC BY 4.0 で利用できます。生成AIを活用して作成・編集した内容を含みます。コードについて、別途ライセンス表示またはリンク先GitHubリポジトリのライセンスがある場合は、その条件を優先します。引用・第三者資料・画像・商標等は本ライセンスの対象外です。 利用ポリシー

タイトルとURLをコピーしました