XAML图像仅显示在设计上

时间:2015-12-02 10:57:55

标签: xaml visual-studio-2015

所以我在XAML中有这个代码,基本上我是在为它添加图像图标。然而,它们只出现在设计视图中,我不知道我将如何让它们显示在运行时视图中:( Ps。我是xaml和stackoverflow的新手,所以我希望显示这条消息很好......

感谢。这是代码:

<UserControl x:Class="NewspaperArticle.TextEditorToolbar"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300">

<ToolBarTray x:Name="top"
             DockPanel.Dock="Top">

    <ToolBar>
        <Button ToolTip="Open"
                Click="Open_Click">

            <Image Source="Icons/open.png"
                   Height="30"
                   Width="30"/>
        </Button>

        <Button ToolTip="Save"
                Click="Save_Click">

            <Image Source="Icons/save.png"
                   Height="30"
                   Width="30"/>
        </Button>


            <Button ToolTip="Cut"
                    Command="ApplicationCommands.Cut">
                <Image Source="Icons/cut-icon.gif"
                       Height="30"
                       Width="30"/>
            </Button>

        <Button ToolTip="Open">
            <Image Source="Icons/open.png"
                   Height="30"
                   Width="30"/>

        </Button>

        <Button ToolTip="Coyp"
                Command="ApplicationCommands.Copy">
            <Image Source="Icons/copy.png"
                   Height="30"
                   Width="30"/>
        </Button>

        <Button ToolTip="Paste"
                Command="ApplicationCommands.Paste">
            <Image Source="Icons/Paste.png"
                   Height="30"
                   Width="30"/>
        </Button>

    </ToolBar>

    <ToolBar>

        <ToggleButton x:Name="boldButton"
                      ToolTip="Bold"
                      Command="EditingCommands.ToggleBold">

            <Image Source="Icons/text_bold.png"
                   Height="25"
                   Width="25"/>
        </ToggleButton>

        <ToggleButton x:Name="italicButton"
                      ToolTip="Italic"
                      Command="EditingCommands.ToggleItalic">

            <Image Source="Icons/text_italic.png"
                   Height="25"
                   Width="25"/>
        </ToggleButton>

        <ToggleButton x:Name="underlineButton"
                      ToolTip="Underline"
                      Command="EditingCommands.ToggleUnderline">

            <Image Source="Icons/text_underline.png"
                   Height="25"
                   Width="25"/>
        </ToggleButton>

        <Separator/>

        <ComboBox x:Name="fonts"
                  MinWidth="100"
                  ItemsSource="{x:Static Fonts.SystemFontFamilies}"
                  ToolTip="Fonts"/>

        <ComboBox x:Name="fontsize"
                  MinWidth="40"
                  ToolTip="Font Size"
                  SelectedIndex="0">

        </ComboBox>

    </ToolBar>

</ToolBarTray>

0 个答案:

没有答案