LoginSignup
4
5

More than 5 years have passed since last update.

タスクバーにあるウィンドウサムネイル(?)に再生ボタンを付けてみる

Last updated at Posted at 2019-02-27

経緯

オーディオプレイヤーを作ってみたのですが、ウィンドウを出してくるのも手間だったので実装しようと思いました。

まずはやってみる

ざっと、こんな感じです。

MainWindow.xaml
<Window x:Class="Test.MainWindow"
        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:local="clr-namespace:Test"
        mc:Ignorable="d"
        Title="Window" Height="485" Width="536" ResizeMode="NoResize">
<!-- ↓ここから重要! -->
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo>
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo x:Name="tb_rep_c" ImageSource="icon/1_rep.png"
                             Description="1曲リピート" />
                <ThumbButtonInfo x:Name="tb_plpa_c" ImageSource="icon/play.png"
                             Description="再生/一時停止" Click="tb_play"  />
                <ThumbButtonInfo x:Name="tb_dm_c" ImageSource="icon/rep.png"
                             Description="てすと" />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>
<!-- ↓後はご自由に -->
    <Grid>

はい。これだけです。

スクリーンショット

やっぱりこれだね。
sksho.png

まとめ

<Window.TaskbarItemInfo>
        <TaskbarItemInfo>
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo x:Name="任意の名前" ImageSource="画像リンク"
                             Description="メッセージ" />
                <ThumbButtonInfo x:Name="任意の名前" ImageSource="画像リンク"
                             Description="メッセージ" />
                <ThumbButtonInfo x:Name="任意の名前" ImageSource="画像リンク"
                             Description="てすと" />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>

後は自由に設定すればいいと思います。

参考にしたページ

使用した素材サイト

http://icooon-mono.com/
なんだかんだ言っても、このサイトのアイコンが使いやすいし、種類も多いのでWeb制作にも活用できそうですね。

最後に

初めてQiitaで記事を書きました。
まだ慣れていないので、色々書いてみて慣れていきたいです。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5