繁体   English   中英

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

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

我正在为一个学校的项目工作,我对Ironpython非常了解。 我正在尝试处理几个图像。 我希望能够使用鼠标拖动它们,但是在运行程序时,我什至无法将图像显示在表单上。 它在设计器内部显示得很好,并且在我运行程序后消失了。

到目前为止,这是我的代码...

<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> 

我不明白我在做什么错...

只需删除第一个反斜杠:

<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