---
title: 'WPF ダッシュボードを JSON を読み込んで表示するGUIアプリ（PowerShell + XAML）'
url: 'https://automationse.net/wpf-dashboard-json-powershell'
markdown: 'https://automationse.net/wpf-dashboard-json-powershell.md'
date: '2025-10-02'
description: 'コンセプト XAML … UI の見た目を定義（カード・リスト・リンクなど）。 PowerShell … JSON を読み込み、XAML にバインド、イベント処理（更新ボタン・リンククリックなど）。 JSON … すべての表示データを記述。編集すれば即座に UI に反映。 1. JSON データ (cards.json) 2. PowerShell スクリプト (Mai…'
taxonomy:
  category:
    - IT関連
  tag:
    - PowerShell
    - アプリ
---

# WPF ダッシュボードを JSON を読み込んで表示するGUIアプリ（PowerShell + XAML）

## [WPF ダッシュボードを JSON を読み込んで表示するGUIアプリ（PowerShell + XAML）](https://automationse.net/wpf-dashboard-json-powershell)

  公開日 2025.10.02 更新日 2025.10.02  [PowerShell](https://automationse.net/tag:PowerShell#body-wrapper) [アプリ](https://automationse.net/tag:%E3%82%A2%E3%83%97%E3%83%AA#body-wrapper)  

## コンセプト

- **XAML** … UI の見た目を定義（カード・リスト・リンクなど）。
- **PowerShell** … JSON を読み込み、XAML にバインド、イベント処理（更新ボタン・リンククリックなど）。
- **JSON** … すべての表示データを記述。編集すれば即座に UI に反映。

## 1. JSON データ (`cards.json`)

## 2. PowerShell スクリプト (`Main.ps1`)

## 3. XAML (`MainWindow.xaml`)

## 解説

### 仕組み

- **DataContext** に JSON オブジェクト全体を割り当てています。
- 各コントロールは **Binding** で JSON のプロパティを参照します。
- 例: `<TextBlock Text="{Binding header.title}"/>` は `cards.json` の `header.title` を表示。

### 特徴

- **JSON を編集するだけで UI が変わる**
    新しい KPI を追加したり、ニュースを差し替えたりできます。
- **更新ボタン** で再読込 → DataContext を差し替え。
- **Hyperlink** のクリックは PowerShell 側で `Start-Process` で処理。

### 応用

- `accent` 値を使って色を DataTrigger で切替可能。
- `due` を日付形式にして並び替えや期限色分けも可能。

## まとめ

これをベースに、業務向けのダッシュボードやタスク管理ビューに拡張できます。UI は XAML、データは JSON、制御は PowerShell というシンプルな役割分担により、**管理も拡張も容易**です。

 [ Previous Post](https://automationse.net/powershell-wpf-entrypoint-relaunch-sta) [Next Post ](https://automationse.net/powershell-wpf-load-json-into-datagrid)

---

## Navigation

- Parent: [WordPress Import](https://automationse.net/wordpress-import.md)
- Previous: [PowerShell + WPF で作る「JSONデータを読み込んでビューに表示」](https://automationse.net/powershell-wpf-load-json-into-datagrid.md)
- Next: [PowerShellで作る Dashboard アプリのエントリーポイント解説](https://automationse.net/powershell-wpf-entrypoint-relaunch-sta.md)
