简体   繁体   English

在WPF中使用XAML和ironpython,图像显示在设计器窗口中,但当我运行程序时不显示

[英]Using XAML and ironpython in WPF, image shows in designer window but not when I run the program

I'm working on a project for school, I am extremely knew to ironpython. 我正在为一个学校的项目工作,我对Ironpython非常了解。 I am trying to work with a couple of images. 我正在尝试处理几个图像。 I want to be able to drag them using the mouse, but I can't even get the image to show up on the form when I run the program. 我希望能够使用鼠标拖动它们,但是在运行程序时,我什至无法将图像显示在表单上。 It shows just fine inside the designer, and disappears once I run the program. 它在设计器内部显示得很好,并且在我运行程序后消失了。

here is my code so far... 到目前为止,这是我的代码...

<Window 
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
       Title="WpfApplication3" Height="1000" Width="1000" Background="Green"> 
       <Grid>

        <Button Width="75" Height="50" Click="Button_Click">Push Me</Button>
        <Image  HorizontalAlignment="Left" Height="100" Margin="289,460,0,0" VerticalAlignment="Top" Width="100">
            <Image.Source>
                <BitmapImage UriSource="/Images/atlantafalcons.jpg" />
            </Image.Source>
        </Image>
    </Grid>
</Window> 

I don't understand what I am doing wrong... 我不明白我在做什么错...

Just remove first backslash: 只需删除第一个反斜杠:

<Grid>
    <Button Width="75" Height="50" Click="Button_Click">Push Me</Button>
    <Image  HorizontalAlignment="Left" Height="100" Margin="289,460,0,0" VerticalAlignment="Top" Width="100">
        <Image.Source>               
            <BitmapImage UriSource="Images/atlantafalcons.jpg" />
        </Image.Source>
    </Image>
</Grid>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM