0

我正在尝试将 WPF 用户控件放在WinForm使用中ElementHost,但由于我的图标未显示在按钮上。

http://gyazo.com/7dc201e30246b2b2676060de0ebf35a9

http://gyazo.com/67f039ce310d17a2d270c816ebc5fb3b

<ToolBar>
    <Button>
        <StackPanel Orientation="Horizontal">
            <Image Source="pack://siteoforigin:,,,/Resources/document-add2.png"  Stretch="None" Margin="0,0,3,0" />
                <TextBlock>Добавить стратегию</TextBlock>
        </StackPanel>
    </Button>

    <Button>
        <StackPanel Orientation="Horizontal">
            <Image Source="pack://siteoforigin:,,,/Resources/document-delete2.png"  Stretch="None" Margin="0,0,3,0" />
            <TextBlock>Удалить стратегию</TextBlock>
        </StackPanel>
    </Button>

    <Separator></Separator>

    <Button>
        <StackPanel Orientation="Horizontal">
            <Image Source="pack://siteoforigin:,,,/Resources/document-control_play.png"  Stretch="None" Margin="0,0,3,0" />
            <TextBlock>Запустить стратегию</TextBlock>
        </StackPanel>
    </Button>

    <Separator></Separator>

    <Button>
        <StackPanel Orientation="Horizontal">
            <Image Source="pack://siteoforigin:,,,/Resources/document-gear.png"  Stretch="None" Margin="0,0,3,0" />
            <TextBlock>Изменить настройки</TextBlock>
        </StackPanel>
    </Button>
</ToolBar>
4

1 回答 1

0

你指定了你的siteoforigin?

如果可以在同一个项目中找到图像,请尝试:

<Button>
    <StackPanel Orientation="Horizontal">
        <Image Source="pack://application:,,,/Resources/document-gear.png"  Stretch="None" Margin="0,0,3,0" />
        <TextBlock>Изменить настройки</TextBlock>
    </StackPanel>
</Button>

所以:pack://application:,,,/[path from root of project]

于 2013-06-28T11:06:07.400 回答