エンジニアの備忘録

エンジニアの私が備忘録や思ったことをちょいちょい書いてます。

C# WPF-Tips-アプリのアイコン設定

アイコンとは

アイコンとは下記の左上の画像の事です。

アイコンあり
f:id:dasuma20:20191119213439p:plain

アイコンなし
f:id:dasuma20:20191119213654p:plain

アイコンなしは寂しいのせ是非設定しましょう。


設定方法

XAMLにIconを設定します。

<Window x:Class="StockData.View.StockDataView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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"
        xmlns:vali="clr-namespace:StockData.Validation"
        xmlns:local="clr-namespace:StockData"
        mc:Ignorable="d"
        Title="StockData" Height="400" Width="410"
        Icon="/img/icon.png">

具体的に言うと下記です。

Icon="/img/icon.png"

f:id:dasuma20:20191119214020p:plain


意外と簡単な事ですが、
意外とやり方忘れてしまいます。