WPF - Buttonの中に絵を表示

エッセンシャルWPF:Windows Presentation Foundation (Programmer's SELECTION)

エッセンシャルWPF:Windows Presentation Foundation (Programmer's SELECTION)

ボタンの中に絵を設定

Windows1.xaml

<Window x:Class="WpfGraphicButton.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Button Height="40" Width="110">
            <Button.Content>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                    <Image Source="/WpfGraphicButton;component/test.bmp" Width="30"></Image>
                    <TextBlock
                    Text="実行する" VerticalAlignment="Center"/>
                </StackPanel>
            </Button.Content>
        </Button>
    </Grid>
</Window>